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 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题