我使用此指南(https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04)将我的Django项目部署在Digital Ocean上,完成了指南中显示的步骤,当我键入IP地址时,所有这些步骤似乎仍在终端上正确运行此时会显示Nginx欢迎页面的网站。
配置Ngnix后,网站可以正常使用此命令(gunicorn --bind 0.0.0.0:8000 NGOsamyak.wsgi
)。
/ etc / nginx / sites-available / NGOsamyak
server {
listen 80;
server_name 165.22.216.110;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/samyakbvs/NGOsamyak-project;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/samyakbvs/NGOsamyak-project/NGOsamyak.sock;
}
}
答案 0 :(得分:0)
您似乎在命令sudo ln
中错过了空格
须藤ln -s / etc / nginx / sites-available / NGOsamyak / etc / nginx / sites-enabled
应该是
sudo ln -s /etc/nginx/sites-available/NGOsamyak /etc/nginx/sites-enabled
运行sudo nginx -t
验证一切正确。
然后最终运行sudo systemctl restart nginx