### 1.下载
### 2.解压
```
上传:/opt
解压后:/opt/nginx-1.8.0
```
### 3.环境安装配置(yum安装,需要网络)
```
yum install gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
```
### 4.执行配置命令
```
执行位置:/opt/nginx-1.8.0
创建临时文件目录:临时文件目录指定为/var/temp/nginx,需要在/var下创建temp及nginx目录
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
```
### 5.执行编译安装命令
```
make
make install
```
### 6.启动nginx
```
安装目录启动:/usr/local/nginx
cd sbin
执行启动命令:./nginx
```
### 7.重启后出现问题:pid
```
问题:
nginx: [emerg] open() "/var/run/nginx/nginx.pid" failed (2: No such file or directory)
解决:
修改配置文件:/usr/local/nginx/conf/nginx.conf
配置pid: pid /usr/local/nginx/logs/nginx.pid;
检查nginx目录下是否存在logs,如果没有创建logs目录
cd /usr/local/nginx
ls 是否存在logs,没有
mkdir logs
```