I have nginx installed in /opt/nginx and was installed by Passenger.
I can start it up with
/opt/ngix/sbin/nginx
and my rails app runs fine.
I created a systemd service and when using that,
systemctl start nginx
hangs forever, but nginx is started.
Trying to access my website results in an error where rails is complaining that it can’t talk to the database, even though the database is running and I can connect and query it. After a few minutes nginx crashes.
[Unit]
Description=HTTP server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/conf/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUD $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
Am I missing something or have something misconfigured here?
The problem is definitely not ngix or my rails app. I can get a rails console and interact with the database.
/opt/nginx/sbin/nginx -t
nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /opt/nginx/conf/nginx.conf test is successful