Gunicorn服务文件:
[Unit]
Description=Gunicorn instance for a simple hello world app
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/algotrading/oops
ExecStart=/home/ubuntu/algotrading/venv/bin/gunicorn -b localhost:8000 wsgi:app
Restart=always
[Install]
WantedBy=multi-user.target
/etc/nginx/sites-available/default文件,代理已添加
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_pass http://127.0.0.1:8000;
try_files $uri $uri/ =404;
}
curl http://127.0.0.1:8000/oops/configuration/fetchConfigurations?schema=oops1_v1_sit工作正常,但是http://<public_ip>:8000/oops/configuration/fetchchbox?schema=oops1_v1_sit无法正常工作
1条答案
按热度按时间fd3cxomn1#
我可以通过在/etc/nginx/nginx.conf文件中将user替换为root来解决这个问题。
还有一种方法可以设置nginx和gunicorn:
1.基本命令:启动Gunicorn服务:
重新启动nginx:
sudo systemctl restart nginx