亲测完美centos7部署Nginx1.6.3(附一键安装nginx1.13.8脚本)

1. 创建预备环境

[root@192 ~]# test -f /services/current_apps || mkdir /services/current_apps 2&> /dev/null
[root@192 ~]# test -f /services/download_soft_v || mkdir /services/download_soft_v 2&> /dev/null
[root@192 ~]# yum -y install pcre pcre-devel openssl-devel openssl gcc gcc-c++
[root@192 ~]# cd /services/download_soft_v/
[root@192 download_soft_v]# wget 104.225.234.20/nginx-1.13.8.tar.gz
[root@192 download_soft_v]# tar xf nginx-1.13.8.tar.gz
[root@192 download_soft_v]# cd nginx-1.13.8/
[root@192 nginx-1.13.8]# useradd nginx -s /sbin/nologin -M

2. 编译安装相关

[root@192 nginx-1.13.8]# ./configure --user=nginx --group=nginx --prefix=/services/current_apps/nginx-1.13.8 --with-http_stub_status_module --with-http_ssl_module
[root@192 nginx-1.13.8]#make && make install

6.软连接并测试和启动

[root@192 nginx-1.13.8]# ln -s /services/current_apps/nginx-1.13.8/ /usr/local/nginx
[root@192 nginx-1.13.8]# echo "liuli test ok" > /usr/local/nginx/html/index.html
[root@192 nginx-1.13.8]# /usr/local/nginx/sbin/nginx
[root@192 nginx-1.13.8]# curl 127.0.0.1

附:

一键安装版(复制以下代码到命令行后--->运行sh install_nginx.sh)

cat >>install_nginx.sh << EOF
test -f /services/current_apps || mkdir /services/current_apps 2&> /dev/null
test -f /services/download_soft_v || mkdir /services/download_soft_v 2&> /dev/null
yum -y install pcre pcre-devel openssl-devel openssl gcc gcc-c++
cd /services/download_soft_v/
wget 104.225.234.20/nginx-1.13.8.tar.gz
tar xf nginx-1.13.8.tar.gz
cd nginx-1.13.8/
useradd nginx -s /sbin/nologin -M
./configure --user=nginx --group=nginx --prefix=/services/current_apps/nginx-1.13.8 --with-http_stub_status_module --with-http_ssl_module
make && make install
ln -s /services/current_apps/nginx-1.13.8/ /usr/local/nginx
echo "liuli test ok" > /usr/local/nginx/html/index.html
/usr/local/nginx/sbin/nginx
curl 127.0.0.1
EOF

转载于:https://blog.51cto.com/popli3/2386901

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值