我通过运行nginx -t
检查了配置语法,然后得到结果:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
但是当我跑service nginx restart
失败时。
我在已启用网站的文件夹中有一个名为a.com
的配置文件,其中包含以下内容:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name a.com;
# root /usr/share/nginx/html;
# index index.html index.htm;
root /home/a/public;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
我在Ubuntu 14.10并希望部署rails服务器。
答案 0 :(得分:0)
我手动杀死了nginx的进程,然后再次启动nginx,解决了问题。
答案 1 :(得分:0)
我遇到了这个问题并使用sudo
解决了它:
sudo service nginx restart
启用日志来检查错误可能会有所帮助:
https://www.nginx.com/resources/admin-guide/logging-and-monitoring/