nginx rewrite配置

admin


server {
    listen 86;

    server_name _;

    large_client_header_buffers 4 32k;

    client_max_body_size 50M;
    charset utf-8;

    index index.html;

    #access_log /var/log/cloud.access.log;
    #error_log /var/log/cloud.error.log;

    root /var/www/cmspz-cloud/www/;

    location / {
        try_files $uri $uri/ /index.html?$query_string;
    }

}

default


server {
        listen 80 default_server;
        listen [::]:80 default_server;

large_client_header_buffers 4 32k;
client_max_body_size 50M;
charset utf-8;

        index index.html index.htm index.nginx-debian.html;

        server_name _;

    location /{
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:3000/;
        proxy_redirect off;
    }

    location /parse{
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:1337/parse;
        proxy_redirect off;
    }
    location /admin/{
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:86/;
        proxy_redirect default;
    }
}

你可能感兴趣的:(nginx rewrite配置)