1、下載nginx,並解壓
cd /usr/local/soft
wget http://nginx.org/download/nginx-1.14.1.tar.gz
tar xzf nginx-1.14.1.tar.gz
2、安裝nginx
cd /usr/local/soft/nginx-1.14.1
# 默認prefix=/usr/local/nginx
./configure --prefix=/usr/local/soft/nginx
# 執行make命令
make
# 執行make install命令
# 執行後會創建/usr/local/soft/nginx目錄
make install
3、配置nginx.conf
vim /usr/local/soft/nginx/conf/nginx.conf
修改端口爲8099
4、啓動nginx
# 啓動
/usr/local/soft/nginx/sbin/nginx
# 重啓
/usr/local/soft/nginx/sbin/nginx -s reload
## 常用命令
./nginx # 啓動
./nginx -s stop # 關閉
./nginx -s reload # 重啓
5、查看nginx進程
ps -ef | grep nginx
如下圖:
5、訪問8099端口*