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 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频