Lewis Frost
Lewis Frost

Reputation: 557

Nginx not able to start on digitalocean

I'm following: https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma

I have deployed to the server and it is working.

I am now trying to restart Nginx and I have this error:

lewisfrost@spotfrostjobs:~$  sudo service nginx restart
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

Here is the output of: systemctl status nginx.service

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2016-09-08 16:17:33 UTC; 1min 1s ago
  Process: 24971 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 25834 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 6010 (code=exited, status=0/SUCCESS)

Here is my nginx.conf

upstream puma { server unix:///home/lewisfrost/apps/spotfrost_jobs/shared/tmp/sockets/spotfrost_jobs-puma.sock; }

server { listen 80 default_server deferred; # server_name 138.68.141.169;

 lewisfrost /home/lewisfrost/apps/spotfrost_jobs/current/public; access_log /home/lewisfrost/apps/spotfrost_jobs/current/log/nginx.access.log; error_log /home/lewisfrost/apps/spotfrost_jobs/current/log/nginx.error.log info;

 location ^~ /assets/ { gzip_static on; expires max; add_header Cache-Control public; }

 try_files $uri/index.html $uri @puma; location @puma { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off;

 proxy_pass http://puma; }

 error_page 500 502 503 504 /500.html; client_max_body_size 10M; keepalive_timeout 10; }

Error.log

2016/09/08 15:44:38 [emerg] 24975#24975: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:9
2016/09/08 15:50:38 [emerg] 25086#25086: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:9
2016/09/08 15:58:17 [emerg] 25170#25170: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:9
2016/09/08 16:01:48 [emerg] 25217#25217: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:9
2016/09/08 16:07:08 [emerg] 25623#25623: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:5
2016/09/08 16:15:16 [emerg] 25798#25798: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:5
2016/09/08 16:17:33 [emerg] 25834#25834: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:5

Any help is appreciated, thanks.

Upvotes: 0

Views: 599

Answers (1)

Ninigi
Ninigi

Reputation: 1311

2016/09/08 15:44:38 [emerg] 24975#24975: unknown directive "lewisfrost" in /etc/nginx/sites-enabled/spotfrost_jobs:9

There is an error in your nginx.conf

lewisfrost /home/lewisfrost/apps/spotfrost_jobs/current/public;

should be

root /home/lewisfrost/apps/spotfrost_jobs/current/public;

as the error message said the directive "lewisfrost" does not exist, but "root" does :D If it wasn't a typo, I guess you figured it was the users name, but it is actually the command to tell the server where root file for the app is.

Upvotes: 1

Related Questions