HI,<br><br>I'm a chinese ,sorry for my poor english.<br><br>I'm new to nginx. I have installed nginx 0.7.67 ,and installed flup ,web.py to use python .<br>I writer a simple test.py file ,and just run : python test.py . VIsit <a href="http://ip:8080">http://ip:8080</a> and it works well.<br>
That means the web.py is right installed.<br><br>So, I try to use nginx with this python file.<br>I edit the nginx.conf like this:<br><br> fastcgi_pass <a href="http://127.0.0.1:9000">127.0.0.1:9000</a>;<br>
fastcgi_param SERVER_NAME $server_name;<br> fastcgi_param SERVER_PORT $server_port;<br> fastcgi_param SERVER_ADDR $server_addr;<br> fastcgi_param REMOTE_ADDR $remote_addr;<br>
fastcgi_param REMOTE_PORT $remote_port;<br> fastcgi_param SERVER_PROTOCOL $server_protocol;<br> fastcgi_param PATH_INFO $fastcgi_script_name;<br> fastcgi_param REQUEST_METHOD $request_method;<br>
fastcgi_param QUERY_STRING $query_string;<br> fastcgi_param CONTENT_TYPE $content_type;<br> fastcgi_param CONTENT_LENGTH $content_length;<br><br><br>and use spawn-fcgi to start up the python file :<br>
<br> spawn-fcgi -f FILE -a 127.0.0.1 -p 9000<br><br>then visit the address <a href="http://ip">http://ip</a> it works ,shows the result what I wanted .<br><br>and then I simply change the fastcgi_pass method TCP to UNIX SOCKET <br>
<br>nginx.conf : fastcgi_pass unix:/tmp/nginx.socket<br><br>spawn-fcgi command : spawn-fcgi -f FILE -s /tmp/nginx.socket ( And change the mod of /tmp/nginx.socket to 777 ).<br><br>This times it works well too .<br><br>
<br>Then I just did a simple test for this two different way of connections between nginx and spawn-fcgi .<br><br>I use webbench to do this test : webbench -c 100 <a href="http://IP/">http://IP/</a> <br><br>This is the result:<br>
<br>USE TCP Method:<br><br>Speed=5730 pages/min, 14038 bytes/sec.
<br>Requests: 2865 susceed, 0 failed.
<br><br>USE UNIX SOCKET Method:<br><br>Speed=5548 pages/min, 13592 bytes/sec.
<br>Requests: 2774 susceed, 0 failed.
<br><br>Why the test shows that TCP method is faster than Unix Socket ?<br><br>And an other quertion is :during the TCP Method test ,I typed : netstat -an | grep 9000 ,this were many ports shows <br>TIME WAIT .almost over 3,000 . when the webbench is over ,zhe TIME WAIT ports number is decrease.<br>
Why this ,And is it safe ?<br><br><br>THANKS<br>