我的网站遇到了一个奇怪的问题(nginx1.7 + uwsgi2.0 + django1.6)。
今天我看到我的uwsgi日志中有一些奇怪的日志条目。 片段:
Mon Aug 31 10:43:17 2015 - WSGI app 1 (mountpoint='zc.qq.com|') ready in 0 seconds on interpreter 0xf627c0 pid: 18360
zc.qq.com {address space usage: 421933056 bytes/402MB} {rss usage: 102522880 bytes/97MB} [pid: 18360|app: 1|req: 1/7] 61.132.52.107 () {42 vars in 684 bytes} [Mon Aug 31 10:43:17 2015] GET /cgi-bin/common/attr?id=260714&r=0.6131902049963026 => generated 0 bytes in 6113 msecs (HTTP/1.1 301) 4 headers in 210 bytes (2 switches on core 0)
zc.qq.com {address space usage: 421933056 bytes/402MB} {rss usage: 102522880 bytes/97MB} [pid: 18360|app: 1|req: 2/8] 61.132.52.105 () {44 vars in 986 bytes} [Mon Aug 31 10:43:29 2015] GET /cgi-bin/common/attr?id=260714&r=0.1676001222494321 => generated 0 bytes in 3 msecs (HTTP/1.1 301) 4 headers in 210 bytes (2 switches on core 0)
实际上,zc.qq.com与我的网站无关。 那么,这个人怎么进入我的服务器? 它作为一个wsgi应用程序坐在这里,因此,有时会继续与我自己的django应用程序一起重启,因此,有时需要django应用程序超过5秒才能响应http请求。
我看到奇怪的应用程序的pid是18360.所以,在这里:
[root@localhost uwsgi]# ps -ef|grep uwsgi
root 18352 1 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18353 18352 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18354 18352 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18355 18352 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18356 18352 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18357 18352 0 10:40 ? 00:00:12 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18358 18352 0 10:40 ? 00:00:00 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18359 18352 0 10:40 ? 00:00:13 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18360 18352 1 10:40 ? 00:00:18 uwsgi -x /home/uwsgi/uwsgi2.xml
root 18871 18818 0 11:07 pts/2 00:00:00 grep uwsgi
它来自uwsgi ......但这里是uwsgi配置文件:
<uwsgi>
<socket>/var/run/uwsgi.socket</socket>
<listen>100</listen>
<master>true</master>
<vhost>true</vhost>
<no-site>true</no-site>
<pidfile>/usr/local/nginx/uwsgi.pid</pidfile>
<processes>8</processes>
<profiler>true</profiler>
<memory-report>true</memory-report>
<enable-threads>true</enable-threads>
<logdate>true</logdate>
<limit-as>6048</limit-as>
<daemonize>/home/django.log</daemonize>
</uwsgi>
而且,这里是nginx.conf中的片段(域名只是这里的示例)
server {
listen 80;
server_name www.mysite.com;
location / {
uwsgi_pass unix:///var/run/uwsgi.socket;
include uwsgi_params;
uwsgi_param UWSGI_CHDIR /home/mysite;
uwsgi_param UWSGI_SCRIPT wsgi;
access_log off;
}
location /static/ {
root /home/mysite/;
access_log off;
log_not_found off;
autoindex on;
}
}
因此,与zc.qq.com或其他strage域相关的任何配置文件中的确切内容(我也看到proxyjudge.info)。
之前有人打过这个吗?
感谢。 韦斯利
答案 0 :(得分:1)
这是因为您启用了虚拟主机和动态应用,但是您没有从nginx端进行任何检查。对未配置(在uWSGI)域中的第一个请求将导致要加载的新应用程序