在Linux上部署Nginx,反向代理tornado的WebSite

1.安装 Nginx

yum install -y nginx

2. 修改nginx配置文件

cd /etc/nginx/
mv nginx.conf nginx.conf.swf
mv nginx.conf.default nginx.conf
vi nginx.conf
upstream tornados{
        server 127.0.0.1:8888;
    }
    proxy_next_upstream error;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            #root   html;
            #index  index.html index.htm;
            proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_pass http://tornados;
       }

3.启动tornado

/root/anaconda3/envs/demo/bin/python  /root/python_codes/tornadodemo/main.py 

4.启动Nginx

systemctl start nginx.service
systemctl stop nginx.service
systemctl restart nginx.service
systemctl enable nginx.service

5.访问网址

http://190.39.90.3/test

enjoy :)...

posted @ 2019-09-17 17:48  bigdog  阅读(354)  评论(0编辑  收藏  举报