源碼安裝Nginx:
tar -zxvf nginx-1.8.0.tar.gz -C /nginx/
#解壓Nginx
rpm -ivh keepalived-1.2.13-5.el6_6.i686.rpm
#安裝keepalived
service iptables status
#查看系統防火牆狀態
service iptables stop
#中止系統防火牆(重啓後恢復)
chkconfig iptables --list
#查看系統防火牆
chkconfig iptables off
#禁用防火牆
安裝pre庫:
yum install -y pcre-devel在線或離線安裝
添加軟鏈接:
cd /lib/
ls *pcre*
find / -type f -name *libpcre.so.*
ln -s /lib/libpcre.so.0.0.1 /lib/libpcre.so.1
編譯安裝Nginx:
cd
/nginx/
make && make install
cd /usr/local/nginx/
./sbin/nginx啓動Nginx服務器
啓動nginx
http://192.168.38.128/瀏覽器訪問,測試nginx是否可用
ps -aux | grep nginx查看nginx進程
./sbin/nginx -s stop中止nginx(不使用)
./sbin/nginx -s quit完成任務退出
./sbin/nginx -s reload至關於重啓(加載配置文件)
./sbin/nginx -t
檢查nginx.conf配置文件語法
nginx -V
查看版本
進入tomcat1
sh ./apache-tomcat-7.0.47/bin/startup.sh
tail -n 300 catalina.out
http://192.168.38.131:8080/
安裝keepalived:
rpm -qa | grep openssl
rpm -ivh keepalived-1.2.13-5.el6_6.i686.rpm
rpm -ql keepalived
service keepalived start
service keepalived restart
service keepalived stop
tail -f /var/log/messages
ip add show eth0
vim check_nginx.sh
http://192.168.38.136/能夠訪問tomcat
./check_nginx.sh//先關閉Nginx
Nginx代理配置(代理多個tomcat):
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location /jenkins {
proxy_pass http://localhost:8082;
}
location /go {
proxy_pass http://localhost:8153;
}
error_page 500502503504/50x.html;
location =/50x.html {
root html;
}
}
附件列表