ip | 备注 |
---|---|
192.168.174.130 | 关闭防火墙,A端,安装好nginx服务,并能网页访问 |
192.168.174.131 | 关闭防火墙,B端 ,安装好nginx服务,并能网页访问 |
正向代理:B代理A 86端口
反向代理:B代理A 8443端口
一:正向代理
配置访问权限使得192.168.174.130只能被192.168.174.131访问
# cat /usr/local/nginx/conf/client-allow.conf
allow 192.168.174.131; //配置白名单
#cat nginx.conf
...
include client-allow.conf; //主机白名单
deny all; //除了主机白名单中的主机,拒绝所有
...
配置192.168.174.131正向代理192.168.174.130:86
修改web文件
#vi /usr/local/nginx/conf/vhost/ecshop.conf
server
{
listen 80;
server_name mail.test.com;
default_type 'text/html';
charset utf-8;
index index.php index.html index.htm;
root /data/nginx/default;
resolver 114.114.114.114; //域名解析服务器
location / {
proxy_pass http://192.168.174.130:86$request_uri;
}
...
}
修改windows internet属性
访问成功
二:反向代理
在192.168.174.131虚拟机上配置反向代理192.168.174.130:8443
#vi /usr/local/nginx/conf/vhost/ecshop.conf
server
{
listen 80;
server_name mail.test.com;
default_type ‘text/html’;
charset utf-8;
index index.php index.html index.htm;
root /data/nginx/default;
location ~ / {
proxy_pass http://192.168.174.131:8443$request_uri;
}
…
}
访问192.168.174.131后成功跳转到192.168.174.130:8443