linux服务器
系统centos7
[root@VM_217_249_centos conf]# uname
Linux
[root@VM_217_249_centos conf]# uname -a
Linux VM_217_249_centos 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@VM_217_249_centos conf]#
安装编译工具及库文件
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
安装prce
PCRE 作用是让 Ngnix 支持 Rewrite 功能。
tar zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure
### 安装
make && make install
### 移动
cd ../
mv pcre-8.35 /usr/local/pcre-8.35
##### 查看版本 #####
pcre-config --version
[root@iZ23lynfsq4Z qiuyuan]# pcre-config --version
8.35
[root@iZ23lynfsq4Z qiuyuan]#
安装nginx
tar -zxvf nginx-1.12.0.tar.gz
cd nginx-1.12.0
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-stream --with-http_ssl_module --with-pcre=/usr/local/pcre-8.35
make && make install
##### 创建 Nginx 运行使用的用户 www
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www
cd ../
##### 修改配置
把https://github.com/edgeto/oneKey/blob/master/nginx/nginx.conf配置下载为nginx.conf
把nginx.conf 移动到/usr/local/nginx/conf/下
#### 查看配置
cd /usr/local/nginx/conf/ && ll | grep nginx.conf
[root@VM_217_249_centos conf]# cd /usr/local/nginx/conf/ && ll | grep nginx.conf
-rw-r--r--. 1 root root 3379 Jul 20 15:37 nginx.conf
-rw-r--r--. 1 root root 2656 Nov 24 2017 nginx.conf.default
[root@VM_217_249_centos conf]#
#### 添加子站点目录
mkdir conf.d
##### 设置启动脚本
echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local
##### 启动nginx
/usr/local/nginx/sbin/nginx
##### 设置变量环境
echo "PATH=$PATH:/usr/local/nginx/sbin" >> /etc/profile
export PATH=$PATH:/usr/local/nginx/sbin
##### 查看版本 #####
nginx -v
[root@VM_217_249_centos conf]# nginx -v
nginx version: nginx/1.12.2
[root@VM_217_249_centos conf]#