Linux系列之Nginx搭建教程

举报
yd_273762914 发表于 2020/12/02 22:59:03 2020/12/02
【摘要】 ##【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 && ...

##【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

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。