Nginx reverse proxy configure and something else

Alala

yoursite.com域名下的所有路径均反向代理到localhost:8080:

server {
        root /var/www/html;
    server_name yoursite.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;
    }
#ssl settings
}

将根路径代理到localhost:8080而将/web02代理到localhost:18080

    server {
        server_name yoursite.com;

        location / {
            proxy_set_header Host $host;
            proxy_pass http://localhost:8080/;
            sub_filter "http://yoursite.com/" "http://localhost:8080/";
            sub_filter_once off;
        }

        location /web02/ {
            proxy_set_header Host $host;
            proxy_pass http://localhost:18080/;
            sub_filter "http://yoursite.com/" "http://localhost:18080/";
            sub_filter_once off;
        }
#ssl confs
}