Nginx无法启动digitalocean

时间:2016-09-08 16:20:32

标签: ruby-on-rails nginx capistrano digital-ocean puma

我正在关注:https://www.digitalocean.com/community/tutorials/deploying-a-rails-app-on-ubuntu-14-04-with-capistrano-nginx-and-puma

我已经部署到服务器并且它正在运行。

我现在正在尝试重新启动Nginx,我有这个错误:

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.

以下是输出: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)

这是我的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

感谢任何帮助,谢谢。

1 个答案:

答案 0 :(得分:1)

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

你的nginx.conf

中有错误
lewisfrost /home/lewisfrost/apps/spotfrost_jobs/current/public;

应该是

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

正如错误消息所说的指令" lewisfrost"不存在,但" root"做:D 如果它不是拼写错误,我想你认为它是用户名,但它实际上是告诉服务器应用程序的根文件所在的命令。