Centos 几个小时后,某些页面出现500内部服务器错误
几小时后,我的站点的某个页面上出现了500个内部服务器错误。我用Centos 几个小时后,某些页面出现500内部服务器错误,centos,nginx,python,uwsgi,flask,Centos,Nginx,Python,Uwsgi,Flask,几小时后,我的站点的某个页面上出现了500个内部服务器错误。我用uWSGI--ini/home/metheuser/webapps/ers\u portal/ers\u portal\u uWSGI.ini重新启动了uWSGI实例,它又运行了几个小时 网站的其余部分似乎正在工作。当我导航到my_table时,我会被引导到login页面。但是,在登录时,我的表页面上出现了500错误。我按照步骤设置了我的nginx和uwsgi配置 也就是说,我在我的应用程序文件夹中找到了ers\u portal\u
uWSGI--ini/home/metheuser/webapps/ers\u portal/ers\u portal\u uWSGI.ini
重新启动了uWSGI实例,它又运行了几个小时
网站的其余部分似乎正在工作。当我导航到my_table
时,我会被引导到login
页面。但是,在登录时,我的表页面上出现了500
错误。我按照步骤设置了我的nginx和uwsgi配置
也就是说,我在我的应用程序文件夹中找到了ers\u portal\u nginx.conf
,该文件夹被符号链接到/etc/nginx/conf.d/
。我在上面提到的屏幕
实例中启动我的uWSGI“实例”(不确定确切的名称),其中.ini
文件位于我的应用程序文件夹中
我的ers\u portal\u nginx.conf
:
server {
listen 80;
server_name www.mydomain.com;
location / { try_files $uri @app; }
location @app {
include uwsgi_params;
uwsgi_pass unix:/home/metheuser/webapps/ers_portal/run_web_uwsgi.sock;
}
}
我的ers\u门户网站\u uwsgi.ini
:
[uwsgi]
#user info
uid = metheuser
gid = ers_group
#application's base folder
base = /home/metheuser/webapps/ers_portal
#python module to import
app = run_web
module = %(app)
home = %(base)/ers_portal_venv
pythonpath = %(base)
#socket file's location
socket = /home/metheuser/webapps/ers_portal/%n.sock
#permissions for the socket file
chmod-socket = 666
#uwsgi varible only, does not relate to your flask application
callable = app
#location of log files
logto = /home/metheuser/webapps/ers_portal/logs/%n.log
myviews.py的相关部分
data_modification_time = None
data = None
def reload_data():
global data_modification_time, data, sites, column_names
filename = '/home/metheuser/webapps/ers_portal/app/static/' + ec.dd_filename
mtime = os.stat(filename).st_mtime
if data_modification_time != mtime:
data_modification_time = mtime
with open(filename) as f:
data = pickle.load(f)
return data
@a bunch of authentication stuff...
@app.route('/')
@app.route('/index')
def index():
return render_template("index.html",
title = 'Main',)
@app.route('/login', methods = ['GET', 'POST'])
def login():
login stuff...
@app.route('/my_table')
@login_required
def my_table():
print 'trying to access data table...'
data = reload_data()
return render_template("my_table.html",
title = "Rundata Viewer",
sts = sites,
cn = column_names,
data = data) # dictionary of data
我通过yum安装了nginx(昨天)
我正在使用通过pip安装在我的venv中的uWSGI
我在CentOS 6
我的uwsgi日志显示:
Wed Jun 11 17:20:01 2014 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 287] during GET /whm-server-status (127.0.0.1)
IOError: write error
[pid: 9586|app: 0|req: 135/135] 127.0.0.1 () {24 vars in 292 bytes} [Wed Jun 11 17:20:01 2014] GET /whm-server-status => generated 0 bytes in 3 msecs (HTTP/1.0 404) 2 headers in 0 bytes (0 switches on core 0)
工作时,视图
“my_表
”路由中的print语句将打印到日志文件中。但一旦它停止工作就不会
有什么想法吗?问题可能是资源泄漏。检查内存使用情况、打开的文件描述符的数量或其他资源使用情况是否随时间而增长。@kasperd因为我正在使用with
打开我的文件,我应该可以吗?我试图设置MySQL日志记录,但似乎不起作用。我是否可以用类似于htop
的东西来监控内存使用情况?似乎类似于@BrianLeach,您可以随时通过/proc/%d/fd
检查进程打开了多少个文件描述符。但是@Oldskool的链接看起来更像是一种解释。