1.nginx反向代理服务
location ~ /test_proxy.html$ {
proxy_pass http://127.0.0.1:8080;(代理访问127.0.0.1:8080)
}
2.nginx正向代理
resolver 8.8.8.8;(dns解析)
location / {
proxy_pass $scheme://$http_host(要访问的主机)$request_uri(主机后面带的参数);
}
nginx配置好代理后在 SwitchyOmega 工具设置代理服务
3.nginx文件代理服务
server {
listen 80;
server_name down-kol.shunwang.com;
location /image_video/ {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
expires 24h;
root /NFS/cloud.shunwang.com;
autoindex on;
}
}
4.nginx域名端口转发
server {
listen 80;
server_name manage.leyou.com;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
proxy_pass http://127.0.0.1:9001;
proxy_connect_timeout 600;
proxy_read_timeout 600;
}
}