*使用nginx代理httpd;

使用nginx代理httpd;

默认httpd中zabbix的配置文件是/etc/httpd/conf.d/zabbix.conf,这个配置文件定义了zabbix的web界面程序所在路径。为了让httpd监听8080端口,还需要修改httpd.conf

[root@DasonCheng ~]# vim /etc/httpd/conf/httpd.conf 
#Listen 12.34.56.78:80
Listen 8080    //将监听端口修改为8080;
……
root@DasonCheng ~]# systemctl restart httpd
[root@DasonCheng ~]# netstat -lntp |grep httpd    //监听端口已经变成8080了;
tcp6       0      0 :::8080                 :::*                    LISTEN      13301/httpd 
……
[root@DasonCheng ~]# vim /usr/local/nginx/conf/vhost/zabbix.conf
server
{
    listen 80;
    server_name www.zabbix.agent.com;    //定义域名;
    location /
    {
        proxy_pass      http://192.168.60.11:8080/;    //定义ip端口
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
……
[root@DasonCheng ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@DasonCheng ~]# /usr/local/nginx/sbin/nginx -s reload
[root@DasonCheng ~]# netstat -lntp |grep  "nginx\|httpd"
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      13455/nginx: master 
tcp6       0      0 :::8080                 :::*                    LISTEN      13301/httpd   
测试:

mark

OK!效果实现了;

转载于:https://my.oschina.net/u/3651233/blog/1531621

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值