1.安装依赖
1 2
| yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
|
2.下载Nginx并解压
1 2 3 4 5 6 7
| cd /usr/local
wget http://nginx.org/download/nginx-1.16.0.tar.gz
tar -xzf nginx-1.16.0.tar.gz
mv nginx-1.16.0 nginx
|
3.安装Nginx
如果make install报错如下:
1 2 3 4 5
| cp conf/koi-win '/usr/local/nginx/conf' cp: ‘conf/koi-win’ and ‘/usr/local/nginx/conf/koi-win’ are the same file make[1]: *** [install] Error 1 make[1]: Leaving directory `/usr/local/nginx' make: *** [install] Error 2
|
则使用./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf
4.启动Nginx
1 2 3 4
| cd /usr/local/nginx
./nginx -c /usr/local/nginx/conf/nginx.conf
|
5.检查Nginx是否启动
下图为启动成功示例:
![启动成功图示](https://WillowLio.github.io/check.png)