【Nginx】错误: [emerg] “proxy_set_header“ directive is not allowed here in D:\sde\phpstudy_pro\...
生活随笔
收集整理的這篇文章主要介紹了
【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\...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 视频背景怎么添加视频背景怎么添加图片
- 下一篇: 花式篮球的基本介绍和动作技巧