我已经在 NGINX 上部署了我的应用程序。我的 error.log 充满了:
upstream timed out (110: Connection timed out) while reading upstream, client: 10.107.46.176, server: myApp, request: "GET /myApp/Home/index.load HTTP/1.1", upstream: "uwsgi://unix:///tmp/web2py.socket:", host: "myApp.eng.home.com", referrer: "http://myApp.eng.home.com/"
我部署了一个 Postgres 数据库。这就是 index.htmlpage 的外观:
<div class="clicks">{{=LOAD(c='Home',f='index',extension='load',ajax=True,timeout=30000,times=3)}}
{{pass}}
</div>
这是 index.load 页面:
{{=numHits}}
这是我的 Home.py 控制器:
def index():
numHits = db(db.opStatus.id > 0).count()
return dict(numHits=numHits)
这在火箭服务器上运行良好,只是在 NGINX 中它失败了。请帮我解决这个问题。
web2py.ini
$ cat /etc/uwsgi/web2py.ini
[uwsgi]
socket = /tmp/web2py.socket
pythonpath = /home/www-data/web2py/
mount = /=wsgihandler:application
processes = 4
master = true
harakiri = 60
reload-mercy = 8
cpu-affinity = 1
stats = /tmp/stats.socket
max-requests = 2000
limit-as = 512
reload-on-as = 256
reload-on-rss = 192
uid = www-data
gid = www-data
touch-reload = /home/www-data/web2py/routes.py
cron = 0 0 -1 -1 -1 python /home/www-data/web2py/web2py.py -Q -S myApp -M -R scripts/sessions2trash.py -A -o
no-orphans = true
uwsgi-emperor.conf
/etc/init$ cat uwsgi-emperor.conf
# Emperor uWSGI script
description "uWSGI Emperor"
start on runlevel [2345]
stop on runlevel [06]
##
#remove the comments in the next section to enable static file compression for the welcome app
#in that case, turn on gzip_static on; on /etc/nginx/nginx.conf
##
#pre-start script
# python /home/www-data/web2py/web2py.py -S welcome -R scripts/zip_static_files.py
# chown -R www-data:www-data /home/www-data/web2py/*
#end script
respawn
exec uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log
皇帝.uwsgi.service
cat /etc/systemd/system/emperor.uwsgi.service
[Unit]
Description = uWSGI Emperor
After = syslog.target
[Service]
ExecStart = /usr/local/bin/uwsgi --ini /etc/uwsgi/web2py.ini
RuntimeDirectory = uwsgi
Restart = always
KillSignal = SIGQUIT
Type = notify
StandardError = syslog
NotifyAccess = all
[Install]
WantedBy = multi-user.target
我正在通过以下方式启动服务:sudo service Emperor.uwsgi start