Ubuntu 由于配置错误,无法启动nginx
我将在我的ubuntu机器上部署名为“converter”的django项目,我将遵循本教程: 我创建了一个名为converter\u nginx.conf的配置文件,并将其放在文件夹/etc/nginx/sites available中。这是我的配置文件的内容:Ubuntu 由于配置错误,无法启动nginx,ubuntu,nginx,uwsgi,nginx-config,Ubuntu,Nginx,Uwsgi,Nginx Config,我将在我的ubuntu机器上部署名为“converter”的django项目,我将遵循本教程: 我创建了一个名为converter\u nginx.conf的配置文件,并将其放在文件夹/etc/nginx/sites available中。这是我的配置文件的内容: # converter_nginx.conf # the upstream component nginx needs to connect to upstream django { # server unix:///hom
# converter_nginx.conf
# the upstream component nginx needs to connect to
upstream django {
# server unix:///home/andrea/File-format-converter/converter/converter.sock; # for a file socket
server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}
# configuration of the server
server {
# the port your site will be served on
listen 8000;
# the domain name it will serve for
server_name 1myIPaddress.com; # substitute your machine's IP address or FQDN
charset utf-8;
# max upload size
client_max_body_size 75M; # adjust to taste
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /home/andrea/File-format-converter/converter/uwsgi_params; # the uwsgi_params file you installed
}
}
并使用以下命令将本教程中所示的文件进行符号链接:sudo ln-s~/home/andrea/file format converter/converter/converter\u nginx.conf/etc/nginx/sites enabled/
。
尽管如此,当我启动nginx时,还是会出现以下错误:[..]启动nginx(通过systemctl):nginx.service的nginx.serviceJob失败,因为控制进程已退出,并显示错误代码。
有关详细信息,请参阅“systemctl status nginx.service”和“journalctl-xe”。
/var/log/nginx
中的error.log
文件包含以下日志:
2019/10/26 09:30:02 [emerg] 30762#30762: open() "/etc/nginx/sites-enabled/converter_nginx.conf" failed (2: No such file or directory) in /etc$
2019/10/26 09:30:17 [emerg] 30818#30818: open() "/etc/nginx/sites-enabled/converter_nginx.conf" failed (2: No such file or directory) in /etc$
2019/10/26 09:38:24 [emerg] 31165#31165: open() "/etc/nginx/sites-enabled/converter_nginx.conf" failed (2: No such file or directory) in /etc$
$/etc/nginx/nginx.conf:62
有人知道为什么会这样吗?我不明白为什么nginx要在
/etc/nginx/nginx.conf
上寻找配置,而不是在已启用的站点或可用的站点上。它正在检查nginx.conf,bcs。它的主配置文件总是加载的。在这种情况下,您可以导入已启用的站点
配置。你检查过你创建的配置文件的权限了吗?您确定文件存在于启用的站点中吗?而不是在网站上提供的?@Maielo非常感谢您的回答!我认为文件不应该真正在站点上启用,因为sites enabled
只包含simlinks?这是错误的吗?Nginx似乎无法打开文件/etc/Nginx/sites enabled/converter\u Nginx.conf
。正如@Maielo所述,您需要检查该文件和/或其符号链接到的文件的所有权和权限。您是否正确创建了符号链接?请尝试从sudo ln-s~/home/andrea/File format converter/converter\u nginx.conf/etc/nginx/sites enabled/
中删除~
,因为这可能会导致路径错误。