我想部署我的django项目与Ubuntu和数字海洋。这不是我第一次这样做,但现在我一直在犯这个错误,我不知道是什么导致了它。我用这个视频作为这个过程的指南:https://www.youtube.com/watch?v=US9BkvzuIxw。这真的很烦人,因为我得到的唯一信息是"502坏网关nginx/1.18.0 (Ubuntu)“,而我在互联网上找到的解决这个问题的方法是行不通的。我运行的所有nginx测试都表明它工作正常。这是我认为错误所在的代码:
/etc/nginx/sites-available/locallibrary
server {
server_name vvmwp.nl;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/sammy/locallibrary;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
/etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=sammy
Group=sammy
EnvironmentFile=/home/sammy/locallibrary/env
WorkingDirectory=/home/sammy/locallibrary
ExecStart=/home/sammy/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
locallibrary.wsgi:application
[Install]
WantedBy=multi-user.target
/etc/systemd/system/gunicorn.socket
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
提前感谢
发布于 2022-11-22 15:29:40
我也面临着同样的问题,但什么也没成功,但在我的例子中,我杀死了之前的端口8080,重新安装了nginx和pm2,一切都很好。
https://stackoverflow.com/questions/71609299
复制相似问题