反向代理(Apache2 & Nginx)
(以 Debian 10 为例)
Apache2
启用反代
sudo a2enmod proxy_http
sudo a2enmod proxy proxy_wstunnel
配置 sites-available/avxxx.conf
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:9003
ProxyPassReverse / http://127.0.0.1:9003
重启
sudo systemctl reload apache2
Nginx
直接在站点配置
location / {
proxy_pass http://127.0.0.1:9003;
proxy_set_header Host 127.0.0.1:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
}