![使用 uwsgi 设置 nginx 作为反向代理](https://linux22.com/image/1626046/%E4%BD%BF%E7%94%A8%20uwsgi%20%E8%AE%BE%E7%BD%AE%20nginx%20%E4%BD%9C%E4%B8%BA%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86.png)
我正在设置一个 nginx 服务器,作为运行我的 python flask 应用程序的 uwsgi 服务器与外部世界之间的代理运行。我已将我的 uwsgi 应用程序设置为监听 /tmp/myapp.sock,并且它运行正常。
我无法让 nginx 正确运行。我的配置文件位于 /usr/local/etc/nginx/nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
sendfile on;
keepalive_timeout 65;
server {
listen 3120;
server_name www.mydomain.com;
# www.mydomain.com exists on DNS.
# Since it updates frequently because I do not have a static ip, I cannot set an IP here.
# Plus, I have forwared port 3120 from my router to my RPI3 running.
location= /myapp {rewrite ^ /myapp/; }
location /myapp { try_files $uri @myapp; }
location @myapp {
include uwsgi_params;
wsgi_pass unix:/tmp/myapp.sock;
}
}
我使用“sudo nginx”来启动 nginx。上面的配置文件在配置测试中没有显示任何错误,但我的网站无法在线!请帮忙。我几天来一直在尝试让它工作。
我在 RPi3 上使用 FreeBSD 12.1。