繁体   English   中英

Nginx + bottle + uwsgi服务器在每个请求上返回404

[英]Nginx+bottle+uwsgi Server returning 404 on every request

我已经使用以下配置设置了Nginx服务器:

server {
        listen 8080;
        server_name localhost;

        location / {
                include uwsgi_params;
                uwsgi_pass unix:/tmp/uwsgi.notesapi.socket;
                uwsgi_param UWSGI_PYHOME /home/ubuntu/notesAPI/env;
                uwsgi_param UWSGI_CHIDIR /home/ubuntu/notesAPI/src;
                uwsgi_param UWSGI_SCRIPT Notes;
        }

}

我已使用以下初始脚本设置了瓶子应用程序:

import sys from settings.constants import PROJECT_ROOT print PROJECT_ROOT sys.path.insert(0, PROJECT_ROOT)

import bottle from bottle import Bottle, debug from settings import routes

Notes = Bottle() routes.set(Notes)

debug(True)
if __name__ == '__main__':
    Notes.run(host='0.0.0.0', port=8080, reloader=True)
else:
    application = bottle.default_app()

当我将GET请求发送到服务器时,即使路由设置正确,我也会收到404。

这是uwsgi.log

[uWSGI]从/usr/share/uwsgi/conf/default.ini获取INI配置

[uWSGI]从/etc/uwsgi/apps-enabled/uwsgi.ini中获取INI配置

2013年6月21日星期五04:47:26- *在[周五6月21日04:47:26]启动uWSGI 1.0.3-debian(64bit)

2013年6月21日星期五04:47:26-使用以下版本编译:4.6.3 on 2012年7月17日02:26:54

2013年6月21日星期五04:47:26-当前工作目录:/

2013年6月21日星期五04:47:26-将pidfile写入/ run / uwsgi / app / uwsgi / pid

2013年6月21日星期五04:47:26-检测到二进制路径:/ usr / bin / uwsgi-core

2013年6月21日星期五04:47:26-setgid()至33

2013年6月21日星期五04:47:26-setuid()至33

2013年6月21日星期五04:47:26-您的内存页面大小为4096字节

2013年6月21日星期五04:47:26-uwsgi套接字0绑定到UNIX地址/ run / uwsgi / app / uwsgi / socket fd 5

2013年6月21日星期五04:47:26-uwsgi套接字1绑定到UNIX地址/tmp/uwsgi.notesapi.socket fd 6

2013年6月21日星期五04:47:26-Python版本:2.7.3(默认,2012年8月1日,05:25:23)[GCC 4.6.3]

2013年6月21日星期五04:47:26-将PythonHome设置为/ home / ubuntu / notesAPI / env

2013年6月21日星期五04:47:26-Python主解释器初始化为0x1f27e60

2013年6月21日星期五04 :47:26-您的服务器套接字监听待办事项限制为100个连接2013年6月21日星期五04 :47:26-*操作模式:预分叉*

2013年6月21日星期五04:47:26-将/ home / ubuntu / notesAPI / src /添加到pythonpath中。

2013年6月21日星期五04:47:26- *未加载任何应用程序。 进入全动态模式*

2013年6月21日星期五04:47:26- * uWSGI在多种解释器模式下运行*

2013年6月21日星期五04:47:26-生成uWSGI主进程(pid:25575)

2013年6月21日星期五04:47:26-产生了uWSGI worker 1(pid:25583,cores:1)

2013年6月21日星期五04:47:26-产生了uWSGI worker 2(pid:25584,cores:1)

/ home / ubuntu / notesAPI / src

2013年6月21日,星期五:04:55:28-WSGI应用程序0(mountpoint ='')在解释器0x1f27e60上准备就绪pid:25583(默认应用程序)[pid:25583 | app:0 | req:1/1] 117.196.135.124() {686个字节中的44个变量} [2013年6月21日星期五,04:55:28] GET / => 188毫秒(HTTP / 1.1 404)中的723个字节生成了87字节中的2个标头(核心0上的1个开关)

我对uwsgi和nginx很陌生。 我似乎无法找出问题所在。

您确定NGINX和UWSGI正常工作吗? 很多事情可能是错误的,我建议您遵循以下指南: https : //uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html

这是使用Django设置NGINX和UWSGI的逐步步骤,但我敢肯定您可以将其应用于除Django之外的任何其他Web应用程序。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM