
配置反向代理

在寶塔面板中新建一個站點,域名填寫公開訪問域名,如 “http://.example.com“ ,然後點擊“設置”進入站點設置選項,選擇“反向代理” – “新建反向代理”
自定義一個代理名稱,在下方“目標 URL”中填入 http://127.0.0.1 然後點擊“保存”
打開剛剛新建的反向代理右邊的“配置文件”,將配置文件替換為以下內容:
For Nginx
location / {
    proxy_pass http://127.0.0.1:8088/;
    proxy_set_header Host      $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
}有websocket需求的用以下代碼
#PROXY-START/
location / {
    proxy_pass http://127.0.0.1:8008;
    proxy_set_header Host $http_host;
    proxy_set_header      Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$  {
    proxy_pass http://127.0.0.1:8008;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
}
#PROXY-END/點擊“保存”
現在,你應該可以直接使用域名,如:“http://cdn.example.com“ 來訪問面板了
