我需要使用 ngnix 和 uwsgi 部署我的 django 站点。它在本地主机中运行良好。但是当我给我的远程服务器时,它不起作用。这是我的 ngnix.conf 文件
# nginx.conf
upstream django {
# connect to this socket
server unix:///tmp/uwsgi.sock; # for a file socket
#server 127.0.0.1:8001; # for a web port socket
}
server {
# the port your site will be served on
listen 80;
# the domain name it will serve for
server_name 192.168.101.191; # substitute your machine's IP address or FQDN
charset utf-8;
#Max upload size
client_max_body_size 75M; # adjust to taste
# Django media
location /media {
alias /home/calcey/django_env_2/employee/media; # your Django project's media files
}
location /static {
alias /home/calcey/django_env_2/employee/static; # your Django project's static files
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include /etc/nginx/uwsgi_params; # or the uwsgi_params you installed manually
}
}
“192.168.101.191”表示我的服务器 IP 地址。如果我放置本地主机而不是“192.168.101.191”,它就可以工作。但对于远程 IP,它不起作用。请给我一个建议。