leeing227 2016-05-13 01:53 采纳率: 0%
浏览 1172

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条回答

  • wsw_dota_IT 2016-05-13 03:34
    关注

    listen 0.0.0.0:80;改成80试试看~

    评论

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试