我的服务器崩溃后,我无法再次启动 uWSGI,并且不断出现unlink()
和以下错误bind()
。
我以 root 身份启动我的服务,因此这变得更加奇怪。
Sun Nov 16 15:25:24 2014 - *** Starting uWSGI 1.2.3-debian (64bit) on [Sun Nov 16 15:25:24 2014] ***
Sun Nov 16 15:25:24 2014 - compiled with version: 4.7.2 on 06 July 2013 12:20:09
Sun Nov 16 15:25:24 2014 - detected number of CPU cores: 1
Sun Nov 16 15:25:24 2014 - current working directory: /
Sun Nov 16 15:25:24 2014 - writing pidfile to /run/uwsgi/app/myserver_dev/pid
Sun Nov 16 15:25:24 2014 - detected binary path: /usr/bin/uwsgi-core
Sun Nov 16 15:25:24 2014 - setgid() to 33
Sun Nov 16 15:25:24 2014 - setuid() to 33
Sun Nov 16 15:25:24 2014 - writing pidfile to /var/www/servers/myserver/development/logs/myserver.pid
Sun Nov 16 15:25:24 2014 - your memory page size is 4096 bytes
Sun Nov 16 15:25:24 2014 - detected max file descriptor number: 1024
Sun Nov 16 15:25:24 2014 - lock engine: pthread robust mutexes
Sun Nov 16 15:25:24 2014 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/myserver_dev/socket fd 3
Sun Nov 16 15:25:24 2014 - unlink(): Permission denied [socket.c line 75]
Sun Nov 16 15:25:24 2014 - bind(): Address already in use [socket.c line 107]
nginx 服务器:
server {
access_log /var/www/servers/example/development/logs/nginx_access.log;
error_log /var/www/servers/example/development/logs/nginx_error.log;
listen 8181;
server_name example.com;
charset utf-8;
}
server {
listen 80;
server_name *.example.com;
return 301 http://example.com$request_uri;
}
server {
access_log /var/www/servers/example/production/logs/nginx_access.log;
error_log /var/www/servers/example/production/logs/nginx_error.log;
listen 80;
server_name example.com;
charset utf-8;
}
server {
listen 7777;
server_name example.com;
charset utf-8;
root /var/www/servers/phpmyadmin;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^/(.+)$ /index.php?url=$1 last;
break;
}
location ~ .php$ {
allow 2.110.234.34;
deny all;
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
uWSGI配置开发:
[uwsgi]
master = true
workers = 2
socket = /var/www/servers/example/development/sockets/example.sock
chmod-socket = 666
log-date = true
uid = www-data
gid = www-data
chdir = /var/www/servers/example/development/webapp
wsgi-file = /var/www/servers/example/development/webapp/webapp/wsgi.py
virtualenv = /var/www/servers/example/development/env
vacuum = true
env = DJANGO_SETTINGS_MODULE=webapp.settings
pidfile2 = /var/www/servers/example/development/logs/example.pid
uWSGI 配置生成
[uwsgi]
master = true
workers = 2
socket = /var/www/servers/example/production/sockets/example.sock
chmod-socket = 666
log-date = true
uid = www-data
gid = www-data
chdir = /var/www/servers/example/production/webapp
wsgi-file = /var/www/servers/example/production/webapp/webapp/wsgi.py
virtualenv = /var/www/servers/example/production/env
vacuum = true
env = DJANGO_SETTINGS_MODULE=webapp.settings
pidfile2 = /var/www/servers/example/production/logs/example.pid