如果我执行systemctl启动nginx,它只会转到下一个空行,而不会让服务器工作,如下所示:
[[/home/sc/pro]]# systemctl start nginx
[[/home/sc/pro]]#如果我做了nginx -t:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful如果我使用netstat -ntlp,我会看到以下内容:
N 1684/nginx: master
tcp6 0 0 :::465 :::* LISTEin /etc/nginx/nginx.conf:
server{
listen 80;
#listen [::]:80 ipv6only=on; <- I tried it too
server_name "my_ip_address";
location = /favicon.ico {access_log off; log_not_found off;}
location /static/ {
root /home/sc/pro/projects/sc/sc_site;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/home/sc/pro/sc_project/sc_project.sock;
}
}此外,如果我执行以下命令,系统将告诉我如下:
(sc_project) [ [/home/sc/pro/projects/sc]]# gunicorn --bind 0.0.0.0:8000 sc.wsgi:application
[2020-09-08 14:05:16 +0000] [4209] [INFO] Starting gunicorn 20.0.4
[2020-09-08 14:05:16 +0000] [4209] [INFO] Listening at: http://0.0.0.0:8000 (4209)
[2020-09-08 14:05:16 +0000] [4209] [INFO] Using worker: sync
[2020-09-08 14:05:16 +0000] [4211] [INFO] Booting worker with pid: 4211但我还是不能去我的网站..。虽然早些时候我刚安装了gunicorn并执行了这个命令,我还是能够到达这个站点.
我使用以下命令终止了httpd进程:
sudo kill -2 ..。在80港..。我之前试过用apache但对我不起作用..。现在我不确定它是httpd还是http进程,以及我是否需要它.但根据-x,它不允许古尼科恩使用端口80.
另外,我也不确定是否正确:我是站点的根用户.我使用了sc命令,它是我的项目的根文件夹(as: /home/ sc ),应该是一个用户名,它保存了树下的所有项目: usermod -a -G sc nginx 710 /home/sc
发布于 2020-09-08 14:41:33
您已经将nginx配置为尝试通过UNIX套接字连接到gunicorn,但是您将gunicorn配置为侦听TCP端口8080。因此他们无法沟通。您必须更改一个或另一个配置,以使它们匹配。
https://serverfault.com/questions/1033079
复制相似问题