通过location正则表达式去解决避免写很多个代理
server {
listen 443 ssl;
server_name ks.local.com;
ssl_certificate /usr/local/ssl/iflytek_com_ca.crt;
ssl_certificate_key /usr/local/ssl/iflytek_com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:!RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
#kslocal 为upstream
location ~ /kapis/terminal.kubesphere.io {
proxy_pass http://kslocal;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header Host $http_host;
}
location ~*/(.*) {
proxy_pass http://kslocal/$1?$args;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}