如何用nginx部署python写的socket服务器代码

展开全部1.安装nginx安装过nginx这就不好从新演示了.默认你也安装好了nginx.2.安装flup$:dpkg -l *flup*打印信息:Desired=Unknown/Install/Remove/Purge/Hold| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)||/ Name Version Description+++-===========================-===========================-======================================================================ii python-flup 0.2126-1 Implements Python Web Server Gateway Interface (WSGI)$:apt-get install python-flup3:配置nginx.conf.这个是按照网上配置的.server {listen 1235;server_name localhost;#charset koi8-r;#access_log /dev/null;access_log /usr/local/nginx/logs/access.log;location / {#location /htm {# root /home/utest/ms;#}root /home/utest/ms;fastcgi_pass 127.0.0.1:1234;fastcgi_param PATH_INFO $fastcgi_script_name;fastcgi_param REQUEST_METHOD $request_method;fastcgi_param QUERY_STRING $query_string;fastcgi_param CONTENT_TYPE $content_type;fastcgi_param CONTENT_LENGTH $content_length;fastcgi_param CONTENT_LENGTH $content_length;include fastcgi_params;fastcgi_pass_header Authorization;fastcgi_intercept_errors off;}}解释:端口:1235--为监听端口.端口:1234----为web服务器运行的端口.from=olddocs展开全部TCP 服务器不需要Nginx这种前端代理. 直接启动并开放对应端口就行.你可以用supervisor之类的启动任务, 防止进程挂掉.