我对NGINX、uWSGI和Pyramid都很陌生,我正在尝试使用nginx作为反向代理通过uWSGI来提供Pyramid应用程序。目前我遇到了困难,希望有人能提出一些解决方案。如果您能稍微解释一下可能发生了什么,那就更好了,因为我的理解非常有限!
目前,当我访问反向代理URL时,uWSGI会返回“内部服务器错误”。在uWSGI错误日志中,我收到以下错误:
当我仅通过uWSGI服务运行应用程序,使用pserve启动时,它能够正常工作。我可以通过以下方式从我的虚拟信封中启动它:
但是当我启动nginx并访问代理地址时,我会收到“内部服务器错误”的提示。
我在uwsgi.ini中的设置如下:
在nginx中对应的myapp.conf文件中,我有以下内容:
如果您需要查看其他内容,请告诉我。正如您所看到的,Nginx 配置为在端口 8080 上提供服务(它确实这样做),Pyramid 应用程序由 uWSGI 提供服务到端口 6543(它确实这样做)。
提前感谢。
目前,当我访问反向代理URL时,uWSGI会返回“内部服务器错误”。在uWSGI错误日志中,我收到以下错误:
--- no python application found, check your startup logs for errors ---
当我仅通过uWSGI服务运行应用程序,使用pserve启动时,它能够正常工作。我可以通过以下方式从我的虚拟信封中启动它:
bin/pserve my-app/uwsgi.ini
但是当我启动nginx并访问代理地址时,我会收到“内部服务器错误”的提示。
我在uwsgi.ini中的设置如下:
[app:main]
use = egg:myapp
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid_debugtoolbar
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
[loggers]
keys = root, musiccircle
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = ERROR
handlers = console
[logger_musiccircle]
level = ERROR
handlers =
qualname = musiccircle
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
[uwsgi]
socket = unix://home/usr/env/myapp/myapp.sock
master = true
processes = 48
cpu-affinity = 12
harakiri = 60
post-buffering = 8192
buffer-size = 65535
daemonize = ./uwsgi.log
pidfile = ./pid_5000.pid
listen = 32767
reload-on-as = 512
reload-on-rss = 192
limit-as = 1024
no-orphans = true
reload-mercy = 8
log-slow = true
virtualenv = /home/usr/env
在nginx中对应的myapp.conf文件中,我有以下内容:
upstream myapp {
server 127.0.0.1:6543;
}
server {
listen 8080;
server_name myapp.local www.myapp.local;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/usr/env/myapp;
}
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
charset utf-8;
location / {
include uwsgi_params;
uwsgi_pass unix://home/usr/env/myapp/myapp.sock;
}
}
如果您需要查看其他内容,请告诉我。正如您所看到的,Nginx 配置为在端口 8080 上提供服务(它确实这样做),Pyramid 应用程序由 uWSGI 提供服务到端口 6543(它确实这样做)。
提前感谢。
pserve
而不是uwsgi
。 - Mikko Ohtamaa