Nginx+battle+uwsgi服务器每次请求返回404

2024-10-02 02:32:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我设置了一个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;
        }

}

我已经设置了一个瓶子应用程序,初始脚本如下:

^{pr2}$

当我向服务器发送GET请求时,即使路由设置得很好,也会得到404。在

这是uwsgi.log

[uWSGI] getting INI configuration from /usr/share/uwsgi/conf/default.ini

[uWSGI] getting INI configuration from /etc/uwsgi/apps-enabled/uwsgi.ini

Fri Jun 21 04:47:26 2013 - * Starting uWSGI 1.0.3-debian (64bit) on [Fri Jun 21 04:47:26 2013] *

Fri Jun 21 04:47:26 2013 - compiled with version: 4.6.3 on 17 July 2012 02:26:54

Fri Jun 21 04:47:26 2013 - current working directory: /

Fri Jun 21 04:47:26 2013 - writing pidfile to /run/uwsgi/app/uwsgi/pid

Fri Jun 21 04:47:26 2013 - detected binary path: /usr/bin/uwsgi-core

Fri Jun 21 04:47:26 2013 - setgid() to 33

Fri Jun 21 04:47:26 2013 - setuid() to 33

Fri Jun 21 04:47:26 2013 - your memory page size is 4096 bytes

Fri Jun 21 04:47:26 2013 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/uwsgi/socket fd 5

Fri Jun 21 04:47:26 2013 - uwsgi socket 1 bound to UNIX address /tmp/uwsgi.notesapi.socket fd 6

Fri Jun 21 04:47:26 2013 - Python version: 2.7.3 (default, Aug 1 2012, 05:25:23) [GCC 4.6.3]

Fri Jun 21 04:47:26 2013 - Set PythonHome to /home/ubuntu/notesAPI/env

Fri Jun 21 04:47:26 2013 - Python main interpreter initialized at 0x1f27e60

Fri Jun 21 04:47:26 2013 - your server socket listen backlog is limited to 100 connections Fri Jun 21 04:47:26 2013 - * Operational MODE: preforking *

Fri Jun 21 04:47:26 2013 - added /home/ubuntu/notesAPI/src/ to pythonpath.

Fri Jun 21 04:47:26 2013 - * no app loaded. going in full dynamic mode *

Fri Jun 21 04:47:26 2013 - * uWSGI is running in multiple interpreter mode *

Fri Jun 21 04:47:26 2013 - spawned uWSGI master process (pid: 25575)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 1 (pid: 25583, cores: 1)

Fri Jun 21 04:47:26 2013 - spawned uWSGI worker 2 (pid: 25584, cores: 1)

/home/ubuntu/notesAPI/src

Fri Jun 21 04:55:28 2013 - WSGI application 0 (mountpoint='') ready on interpreter 0x1f27e60 pid: 25583 (default app) [pid: 25583|app: 0|req: 1/1] 117.196.135.124 () {44 vars in 686 bytes} [Fri Jun 21 04:55:28 2013] GET / => generated 723 bytes in 188 msecs (HTTP/1.1 404) 2 headers in 87 bytes (1 switches on core 0)

我对uwsgi和nginx很陌生。我好像搞不懂这个问题。在


Tags: toinapphomebytesserveronubuntu
1条回答
网友
1楼 · 发布于 2024-10-02 02:32:44

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

使用Django设置NGINX和UWSGI是一个循序渐进的过程,但我确信你可以将其应用于除Django之外的任何其他web应用程序。在

相关问题 更多 >

    热门问题