我试图让一个VPS我的Django应用程序运行,我所做的一切都是根据这个教程 ,但我得到一个502错误。
我认为nginx的是侦听端口80(是吗?),因为sudo netstat -nlp | grep 80
sudo netstat -nlp | grep 80
投:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 892/nginx
tcp6 0 0 :::80 :::* LISTEN 892/nginx
unix 2 [ ACC ] STREAM LISTENING 8942 805/acpid /var/run/acpid.socket
但是,当我输入sudo nginx
似乎Nginx的不侦听端口80 ...:
`nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()`
我的Nginx的配置:
server {
server_name 95.85.34.87;
access_log off;
location /static/ {
alias /opt/myenv/static/;
}
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}
}
谁能帮我?