First, start with creating a .env file in the folder containing the release (which can be built using mix release as documented here):

/var/www/mysite.com/.env

In there, add the following settings (update with the settings applicable to your environment):

PHX_HOST=www.mysite.com
PORT=4000
PHX_SERVER=true
SECRET_KEY_BASE=my-secret-key
MIX_ENV=prod
DATABASE_URL=ecto://user:pass@localhost/mysite

Then create a file to define the systemd service:

/etc/systemd/system/mysite-app-server.service

Add the following content:

[Unit]
Description=mysite.com app server

[Service]
User=root
EnvironmentFile=/var/www/mysite.com/.env
Environment=LANG=en_US.utf8
WorkingDirectory=/var/www/mysite.com/
ExecStart=/var/www/mysite.com/_build/prod/rel/mysite/bin/mysite start
ExecStop=/var/www/mysite.com/_build/prod/rel/mysite/bin/mysite stop
KillMode=process
Restart=on-failure
LimitNOFILE=65535
SyslogIdentifier=mysite-app-server

[Install]
WantedBy=multi-user.target

To enable it:

$ systemctl enable mysite-app-server

To reload the config file:

$ systemctl daemon-reload

To start it:

$ systemctl start mysite-app-server

To get the status:

$ systemctl status mysite-app-server

To view the logs:

$ tail -f /var/log/syslog | grep mysite-app-server

If you want to learn more about systemd and the different configuration options, you should check out this article which goes in to much more detail on using systemd with Elixir Phoenix.