nginx-配置记录

 

 贴一个用过的nginx的配置,不包含https的配置

 

   upstream front{
        server 127.0.0.1:8080 weight=10;
    }
    upstream admin{
        server 127.0.0.1:8090 weight=5;
    }
    upstream admin2{
        server 127.0.0.1:8091 weight=5;
    }
    upstream front2{
        server 127.0.0.1:8100 weight=5;
    }
    upstream front3{
        server 127.0.0.1:8110 weight=5;
    }
    server {
        listen 80;
        underscores_in_headers on;
        server_name 域名;
        rewrite ^(.*)/front/(.*) http://域名/front2/$2 redirect;
        index index.jsp index.htm index.php;
        client_max_body_size    1000m;
        fastcgi_connect_timeout 75;
        fastcgi_read_timeout 600;
        fastcgi_send_timeout 600;
        keepalive_timeout  600;
        proxy_connect_timeout 600;
        proxy_read_timeout 600;
        location /front/ {
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://front2;
        }
        location /admin/ {
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://admin;
        }
        location /admin2/ {
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://admin2;
        }
        location /front2/ {
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://front2;
        }
        location /front3/ {
            proxy_redirect off;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
            proxy_pass http://front;
        }
        location ^~ /front/upload/{
            alias /data/upload/;
            access_log off;
            expires 5d;
        }
        location ^~ /admin/upload/{
            alias /data/upload/;
            access_log off;
            expires 5d;
        }
        location ^~ /front2/upload/{
            alias /data/upload/;
            access_log off;
            expires 5d;
        }
        location ^~ /front3/upload/{
            alias /data/upload/;
            access_log off;
            expires 5d;
        }
        location ^~ /MP_verify_29oSzr2bnZTqaOmk.txt{
            alias /data/upload/MP_verify_29oSzr2bnZTqaOmk.txt;
            access_log off;
            expires 5d;
        }
    }

 

posted @ 2018-10-11 23:31  李寅初  阅读(138)  评论(0编辑  收藏  举报