一、 编写nginx反向代理配置
server {
listen 10.0.0.3:80;
server_name www.etiantian.org;
root html;
index index.html index.htm;
location / {
proxy_pass http://noah;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
server {
listen 10.0.0.3:80;
server_name bbs.etiantian.org;
root html;
index index.html index.htm;
location / {
proxy_pass http://noah;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
二、 监听本地网卡上没有的IP地址
echo 'net.ipv4.ip_nonlocal_bind = 1' >>/etc/sysctl.conf#此操作我的模板机已进行优化,但不保证其他机器也会优化,所以写上
sysctl -p三、 重启服务
[root@xxx~]# nginx -s stop
[root@xxx~]# nginx
[root@xxx~]# netstat -lntup|grep nginx
tcp 0 0 10.0.0.3:80 0.0.0.0:* LISTEN 53334/nginx文档更新时间: 2023-08-10 06:28 作者:月影鹏鹏