nginx 1.15.10 前端代理轉發 將多個地址,代理轉發到一個地址和端口 多系統公用一個cookie 統一token

nginx 1.15.10 前端代理轉發 將多個地址,代理轉發到一個地址和端口 多系統公用一個cookie 統一tokenphp

 

注意:html

proxy_pass http://192.168.40.54:2233/xxxx_web/; (結尾有分號)
 
從新加載的reload命令
nginx.exe -s reload

 

nginx 下載 https://nginx.org/en/download.html前端

解壓本地後 看 conf/nginx.confnginx

打開後 在倒數第2行 加入web

include       nginx-xxxx.conf;

就是單獨寫一個配置文件,不改寫公共配置文件,固然也能夠直接寫在配置文件內cookie

小插曲:我本機應該是開了一個80端口,影射着一個目錄,因此把配置文件的端口號從80改爲8000了session

nginx-xxxx.conf

 server { listen 8888; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location /xxxx1_web { # 這個是平臺的接口 proxy_pass http://192.168.999.999:9999/xxxx1_web;
 } location /xxxx2_web { proxy_pass http://192.168.888.888:8999/xxxx2_web;
 } #error_page 404              /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504  /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1;
 #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
 # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #}

 

最後回到解壓的根目錄 運行dos命令url

start nginx.exe

代理就打開了,能夠經過本機的localhost和端口號 看看服務是否開啓,spa

而後 在後面加入 目錄名查看系統.net

相關文章
相關標籤/搜索