Linux系列之Nginx搭建教程
##【keepalived安装】
下载keepalived到/usr/local/src
tar -xzvf keepalived-1.2.19.tar.gz
cd /usr/local/src/keepalived-1.2.19
###配置
./configure --prefix=/usr/local/keepalived
编译
make && make install
###复制建立服务启动脚本,以便使用service命令控制之:
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/rc.d/init.d/
chmod +x /etc/init.d/keepalived
cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/
mkdir /etc/keepalived
cp /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/
cp /usr/local/keepalived/sbin/keepalived /usr/sbin/
启动keepalived
service keepalived start|stop
##【nginx安装】
nginx安装之前要先安装pcre、openssl、zlib
注意:./configure --prefix=/usr/local/keepalived
configure:error:!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files.
解决方法:安装openssl,同时pcre也一起安装一下,gcc、zlib没有安装也可以安装一下
yum -y install pcre pcre-devel openssl openssl-devel zlib* gcc
###解压
下载nginx到/usr/local/src
tar -xzvf nginx-1.11.4.tar.gz
cd nginx-1.11.4
执行配置文件
./configure
编译
make && make install
启动
cd /usr/local/nginx/sbin
./nginx
重启
cd /usr/local/nginx/sbin
./nginx -s reload
检验配置文件是否正确
检验:
ps -ef|grep nginx
/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
或者
cd /usr/local/nginx/sbin
./nginx -t
文章来源: smilenicky.blog.csdn.net,作者:smileNicky,版权归原作者所有,如需转载,请联系作者。
原文链接:smilenicky.blog.csdn.net/article/details/78631548
- 点赞
- 收藏
- 关注作者
评论(0)