nginx安装

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

转载于:https://my.oschina.net/u/3004226/blog/1982050

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值