验证nginx conf文件

时间:2015-03-24 05:24:30

标签: nginx

我正在尝试使用nginx验证其conf文件,但我发现了一些奇怪的错误:

$ nginx -t  -c `pwd`/foo.conf ; echo $?
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
nginx: the configuration file /home/ubuntu/foo.conf syntax is ok
2015/03/24 01:13:08 [emerg] 8464#0: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /home/ubuntu/foo.conf test failed
1

虽然这有效,但它仍然会打印错误消息:

$ nginx -t  -c `pwd`/foo.conf -s stop ; echo $?
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
nginx: the configuration file /home/ubuntu/foo.conf syntax is ok
nginx: configuration file /home/ubuntu/foo.conf test is successful
0

传递-g 'error_log /tmp/error.log;'似乎无效。

这是conf文件:

events  {}
http{
proxy_set_header Host $http_host;

server {
    listen       80;
    server_name  localhost;

    location /ui {
        proxy_pass http://127.0.0.1:8000/ui;
    }
}
}

0 个答案:

没有答案