nginx 配置:
nginx.conf
http {
upstream web {
server 192.168.189.132:8888;
server 192.168.189.132:8888;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /etc/nginx/sites-enabled/*;
}
conf.d/web.conf
server {
listen 80;
server_name web.test.com;
location ^~ /static/ {
root /home/web/;
if ($query_string) {
expires max;
}
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://web;
}
}
listen 80;
server_name web.test.com;
location ^~ /static/ {
root /home/web/;
if ($query_string) {
expires max;
}
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://web;
}
}
python配置
define("port", default=8888, help="run on the given port", type=int)
Application().listen(8888)
tornado.ioloop.IOLoop.instance().start()
tornado.ioloop.IOLoop.instance().start()