我是网络编程的新手,所以我希望在我的配置中缺少一个超级简单的东西,希望你能帮助我!(也原谅我的英语 - 呵呵)
所以事情是这样的:我在 Flask 上的小应用程序上,一切正常。特别是我在搞乱 Flask-Admin:
123.45.67.8:8080/管理员/
返回我的工作管理面板...一旦我从内置服务器切换到 nginx/uWSGI 的 url
www.mywebsite.com/admin/
给我一个 404 ......但仅适用于 Flask-Admin 部分,其他一切都完美!
我使用以下命令启动 uWSGI uwsgi --ini /path/to/myweb_uwsgi.ini
myweb_uwsgi.ini
[uwsgi]
#application's base folder
base = /var/www/myweb
#python module to import
app = myweb
module = %(app)
home = %(base)/venv
pythonpath = %(base)
#socket file's location
socket = /var/www/myweb/%n.sock
#permissions for the socket file
chmod-socket = 666
#the variable that holds a flask application inside the module imported at line #6
callable = app
#location of log files
logto = /var/log/uwsgi/%n.log
这是我的 nginx .conf 文件
server {
listen 80;
server_name localhost;
charset utf-8;
client_max_body_size 75M;
location / { try_files $uri @yourapplication; }
location @yourapplication {
include uwsgi_params;
uwsgi_pass unix:/var/www/myweb/myweb_uwsgi.sock;
}
}
我很确定我在 uWSGI ini 文件中遗漏了一些东西,但我无法弄清楚......