用bottle的一個項目中,uwsgi做爲bottle跟nignx通訊協議,取代fastcgi。python
uwsig配置腳本以下:linux
<uwsgi> <socket>0.0.0:9999</socket> <listen>128</listen> <master>true</master> <pidfile>/yourpythonprojectpathr/log/uwsgi.pid</pidfile> <processes>9</processes> <chdir>/yourpythonprojectpathr/</chdir> <pythonpath>..</pythonpath> <module>application</module> <profiler>true</profiler> <memory-report>true</memory-report> <enable-threads>true</enable-threads> <logdate>true</logdate> <limit-as>512</limit-as> <daemonize>/yourpythonprojectpathr/log/uwsgi.log</daemonize> </uwsgi>
nignx放置前面,作反向代理。app
server { listen 80; server_name server_name; merge_slashes off; location = /favicon.ico { empty_gif; access_log off; } location /cross_origin.htm { expires 30d; } location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9999; } }
能夠看出,全部的請求都會127.0.0.1:9999直接讓bottle處理。問題來了。uwsgi裏的<socket>0.0.0:9999</socket>爲何Ip不是127.0.0.1socket
網上搜尋了好半天,仍是以爲http://www.linuxask.com/questions/what-is-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1解釋的讓我明白this
In fact, this special IP means "all the IP addresses on the local machine". So if you have seen a service listening on 0.0.0.0, it means you can connect to the service using any IP addresses of the machine.spa