Linux系統安裝nginx

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端口*
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章