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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了亲测完美centos7部署Nginx1.6.3(附一键安装nginx1.13.8脚本)相关的知识,希望对你有一定的参考价值。

1. 创建预备环境

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

2. 编译安装相关

[[email protected] 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
[[email protected] nginx-1.13.8]#make && make install

6.软连接并测试和启动

[[email protected] nginx-1.13.8]# ln -s /services/current_apps/nginx-1.13.8/ /usr/local/nginx
[[email protected] nginx-1.13.8]# echo "liuli test ok" > /usr/local/nginx/html/index.html
[[email protected] nginx-1.13.8]# /usr/local/nginx/sbin/nginx
[[email protected] 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

以上是关于亲测完美centos7部署Nginx1.6.3(附一键安装nginx1.13.8脚本)的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7安装Oracle完整教程(超级详细,亲测完美)

oracle 11g r2 rac 安装整理 附详细步骤(亲测VMware和exsi都可以完美安装物理机自然没有问题)

完美安装centos7编译安装php5.6.40(亲测成功!)

CentOS7安装部署Shipyard管理系统(亲测可用)

nginx1.6.3源码安装,centos6系统下详解

ELK部署脚本---亲测可用