日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

【Nginx】错误: [emerg] “proxy_set_header“ directive is not allowed here in D:\sde\phpstudy_pro\...

發布時間:2024/9/19 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Nginx】错误: [emerg] “proxy_set_header“ directive is not allowed here in D:\sde\phpstudy_pro\... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

前言

  • nginx 1.15.11(下面的代碼在此版本測試通過)
  • win10
  • phpstudy 8.1.1.3

錯誤

nginx: [emerg] "proxy_set_header" directive is not allowed here in D:\sde\phpstudy_pro\Extensions\Nginx1.15.11/conf/vhosts/com.3jcf.school-test.conf:45

錯誤寫法

location ~* ^/index.html {if ($query_string ~ ".*(?:^|\?|&)method=autoGenerateIndex(?:(?:&.*)|$)") {# $server_port端口,讓request.getServerPort()能夠獲取正確的端口proxy_set_header Host $host:$server_port;proxy_set_header Remote_Addr $remote_addr;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;# https請求轉成http請求時,weblogic設置proxy_set_header WL-Proxy-SSL true; # https請求轉成http請求時,tomcat設置proxy_set_header X-Forwarded-Proto $scheme;proxy_pass http://127.0.0.1:1011;break;} }

正確寫法

location ~* ^/index.html {# $server_port端口,讓request.getServerPort()能夠獲取正確的端口proxy_set_header Host $host:$server_port;proxy_set_header Remote_Addr $remote_addr;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;# https請求轉成http請求時,weblogic設置proxy_set_header WL-Proxy-SSL true; # https請求轉成http請求時,tomcat設置proxy_set_header X-Forwarded-Proto $scheme;if ($query_string ~ ".*(?:^|\?|&)method=autoGenerateIndex(?:(?:&.*)|$)") {proxy_pass http://127.0.0.1:1011;break;} }

proxy_set_header 指令不能出現在if語句中。

總結

以上是生活随笔為你收集整理的【Nginx】错误: [emerg] “proxy_set_header“ directive is not allowed here in D:\sde\phpstudy_pro\...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。