@TOC
安装nginx
1.安装依赖
yum -y install gcc pcre-devel zlib-devel openssl openssl-devel
2.下载nginx
nginx下载地址:https://nginx.org/download/
我下载的“nginx-1.9.9.tar.gz”
3.上传到服务器
4.解压
tar -xzvf nginx-1.9.9.tar.gz
5.安装
##进入nginx目录
cd nginx-1.9.9
## 配置(注意路径就是安装路径)
./configure --prefix=/usr/local/nginx
# make
make
make install
6.检查是否安装成功
# cd 到配置路径
cd /usr/local/nginx
# 执行
./sbin/nginx -t
7.正常输出
8.如果报错
如果输出7,则忽略8
nginx: [alert] could not open error log file: open() “/usr/local/nginx/logs/error.log” failed (2: No such file or directory)
2016/09/13 19:08:56 [emerg] 6996#0: open() “/usr/local/nginx/logs/access.log” failed (2: No such file or directory)
原因分析:nginx/目录下没有logs文件夹
解决方法:
mkdir logs
chmod 700 logs
9.启动nginx
cd /usr/local/nginx/sbin
# 启动nginx
./nginx
# 重启nginx
./nginx -s reload