一、下载和安装
1 下载
cd /usr/local/
wget http://nginx.org/download/nginx-1.2.8.tar.gz
2 安装
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --prefix=/usr/local/nginx
make
make install
二、启动和重启
1 /usr/local/nginx/sbin/nginx
2 检查是否启动成功:
netstat -ano|grep 80 有结果输入说明启动成功
3 打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功。
如果不能访问,检查防火墙的配置。
路径:/etc/firewalld/zones/public.xml里有没有<service name="http"/>。
如果没有,加上,重启service firewalld restart。
4 重启
/usr/local/nginx/sbin/nginx-s reload
三、代理配置
1
location /hamaster/ {
proxy_pass http://192.168.1.12:8099/stats;
}
location /haslave/ {
proxy_pass http://192.168.1.2:8099/stats;
}