一台云服务器Windows篇:07、Nginx 反向代理

Nginx 反向代理 Axure Cloud for On-Premises Service 配置

Nginx 反向代理 Axure Cloud for On-Premises Service 配置

# --- rp.y.z by AxureCloud / reverse proxy start ---
    server {
        listen       80;
        server_name  rp.y.z;
        
        if ($time_iso8601 ~ "^(\d{4})-(\d{2})") {
            set $year $1;
            set $month $2;
        }
        access_log  logs/access-$year$month-$host.log main;
        # 上传文件大小上限
        client_max_body_size 500m;

        # 自动跳转https
        return 301 https://$host$request_uri;
    }    
    server {
        listen       443 ssl;
        http2 on;
        server_name  rp.y.z;
        # 相对路径 cert/xxx.pem,为在conf目录中
        ssl_certificate      cert/rp.y.z-crt.pem;
        ssl_certificate_key  cert/rp.y.z-key.pem;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on; 
           
        if ($time_iso8601 ~ "^(\d{4})-(\d{2})") {
            set $year $1;
            set $month $2;
        }
        access_log  logs/access-$year$month-$host.log main;
        
        # SSL证书验证: root是相对路径 alias 是绝对路径,验证程序会在root目录下创建[.well-known/acme-challenge/xxx]文件,以[y.z/.well-known/acme-challenge/xxx]访问。
        location ^~ /.well-known/acme-challenge/ {
            default_type "text/plain";
            root certVerify_rp-y-z;
        }
        
        location / {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Server $host;
            proxy_set_header X-Forwarded-Proto $scheme; #AxureCloud重点
            proxy_set_header X-Scheme $scheme; #AxureCloud重点
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://localhost:8080;
            #proxy_redirect off;
        }
    }
# --- rp.y.z by AxureCloud / reverse proxy end ---

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注