leeing227
leeing227
2016-05-13 01:53

flask+uwsgi+nginx问题

我的工程路径是这样:
microblog是根目录:
drwxr-xr-x 5 root root 4096 May 13 09:43 ./
drwxr-xr-x 5 root root 4096 May 13 09:47 ../
drwxr-xr-x 5 root root 4096 May 13 09:41 app/
-rw-r--r-- 1 root root 56 May 13 09:24 config.py
-rw-r--r-- 1 root root 199 May 13 09:26 config.pyc
drwxr-xr-x 6 root root 4096 May 11 11:10 flask/
-rw-rw-rw- 1 root root 186 May 12 13:50 microblog_uwsgi.xml
-rwxr-xr-x 1 root root 87 May 11 11:35 run.py*
drwxr-xr-x 2 root root 4096 May 11 11:11 tmp/

应用目录app:
-rwxr-xr-x 1 root root 103 May 13 09:26 init.py*
-rw-r--r-- 1 root root 299 May 13 09:26 init.pyc
drwxr-xr-x 2 root root 4096 May 11 11:19 scripts/
drwxr-xr-x 2 root root 4096 May 11 11:11 static/
drwxr-xr-x 2 root root 4096 May 12 13:40 templates/
-rwxr-xr-x 1 root root 393 May 11 14:53 views.py*
-rw-r--r-- 1 root root 713 May 11 14:53 views.pyc

我的uwsgi配置文件:

0.0.0.0:9090
app
/home/***/microblog
run.py
app
4

nginx配置:
server {
listen 0.0.0.0:80;
index index.html index.htm ;
server_name localhost;
location / {
try_files $uri $uri/ =404;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
if (!-e $request_filename) {
return 404;
}
root /home/***/microblog;
index index.html index.shtml index.jsp;
}
}

程序里面的路由是:
@app.route('/')
@app.route('/index')
def index():
return *****
我的服务器是在申请的免费云资源,我在外网访问http://lichehuo.cloud.icybee.cn/,
显示的是我的主页。可是我访问http://lichehuo.cloud.icybee.cn/index却报错404.
是哪里配置的不对吗?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐