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

1.安裝 Nginxhtml

yum install -y nginx

2. 修改nginx配置文件python

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.啓動tornadonginx

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

4.啓動Nginxtornado

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

5.訪問網址spa

http://190.39.90.3/test

enjoy :)...rest

相關文章
相關標籤/搜索