1. 程式人生 > >Nginx之安裝部署

Nginx之安裝部署

①下載Nginx安裝包

官網下載地址

http://nginx.org/en/download.html

下載最新的1.15.3版本,nginx-1.15.3.tar.gz

上傳到伺服器,路徑為/opt/nginx

②解壓到當前目錄

tar -xvzf nginx-1.15.3.tar.gz

③安裝gcc,以及nginx的一些依賴包

yum install -y make cmake gcc gcc-c++
yum install -y pcre pcre-devel 
yum install -y zlib zlib-devel 
yum install -y openssl openssl-devel

④進行configure配置

進入nginx的目錄

cd nginx-1.15.3

當前所在目錄為  /opt/nginx/nginx-1.15.3,執行

./configure --prefix=/opt/nginx/nginx

⑤編譯安裝

make && make install

 ⑥進入目錄 /opt/nginx/nginx/sbin,啟動Nginx

./nginx

此時執行

 ps -ef |grep nginx

結果為

root       8913      1  0 12:05 ?        00:00:00 nginx: master process ./nginx
nobody     8914   8913  0 12:05 ?        00:00:00 nginx: worker process
root       8916   3193  0 12:06 pts/1    00:00:00 grep --color=auto nginx

說明Nginx已經啟動成功了

大功告成,Nginx已經成功完成安裝部署