nginx 测试失败,配置文件不同
nginx test failing with different configuration file
我正在尝试测试为什么我的 nginx 无法加载,所以我 运行 命令:
nginx -c nginx.conf -t
并得到输出:
nginx: [emerg] open() "/usr/share/nginx/vehicles/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /usr/share/nginx/vehicles/nginx.conf test failed
这很奇怪,因为它声明的配置文件与我提供的不同。
我的配置文件:
user www-data;
daemon off;
events {
}
http {
##
# Logging Settings
##
#access_log /logs/nginx_access.log;
#error_log /logs/nginx_error.log;
#upstream vehicles_server {
# server unix:/tmp/server.sock
#}
server {
listen 5001;
server_name _;
location / {
proxy_pass unix:/server/server.sock;
}
}
}
我尝试添加 error_logs,但效果不佳。
我是 运行 nginx,在 ubuntu docker 容器中使用 supervisord,以 gunicorn 和 Django 作为网络服务器(尽管我认为它们与问题完全无关)
文件 server.sock 存在。
有什么想法吗?
我在我的服务器上尝试了以下
nginx -c nginx.conf
得到了:
nginx: [emerg] open() "/usr/local/nginx/nginx.conf" failed (2: No such
file or directory)
然后我做了:
nginx -c /usr/local/nginx/conf/nginx.conf
它成功了,尝试使用您的 nginx.conf 的完整路径并且应该有效
我正在尝试测试为什么我的 nginx 无法加载,所以我 运行 命令:
nginx -c nginx.conf -t
并得到输出:
nginx: [emerg] open() "/usr/share/nginx/vehicles/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /usr/share/nginx/vehicles/nginx.conf test failed
这很奇怪,因为它声明的配置文件与我提供的不同。
我的配置文件:
user www-data;
daemon off;
events {
}
http {
##
# Logging Settings
##
#access_log /logs/nginx_access.log;
#error_log /logs/nginx_error.log;
#upstream vehicles_server {
# server unix:/tmp/server.sock
#}
server {
listen 5001;
server_name _;
location / {
proxy_pass unix:/server/server.sock;
}
}
}
我尝试添加 error_logs,但效果不佳。
我是 运行 nginx,在 ubuntu docker 容器中使用 supervisord,以 gunicorn 和 Django 作为网络服务器(尽管我认为它们与问题完全无关)
文件 server.sock 存在。
有什么想法吗?
我在我的服务器上尝试了以下
nginx -c nginx.conf
得到了:
nginx: [emerg] open() "/usr/local/nginx/nginx.conf" failed (2: No such file or directory)
然后我做了:
nginx -c /usr/local/nginx/conf/nginx.conf
它成功了,尝试使用您的 nginx.conf 的完整路径并且应该有效