通用Nginx反向代理设置

server {
    listen 80;

    server_name www.example.com;

    location / {
        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_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:4567;
        proxy_redirect off;

    }
}

Nginx 不带www的裸域名 跳转 带https和www

server {
    listen  80;
    server_name example.com;

    return  301 https://www.example.com$request_uri;
}