1、安裝gcc g++的依賴庫 sudo apt-get install build-essential && sudo apt-get install libtool
2、安裝pcre依賴庫 sudo apt-get install libpcre3 libpcre3-dev
3、安裝zlib依賴庫 sudo apt-get install zlib1g-dev
4、安裝ssl依賴庫 sudo apt-get install openssl libssl-dev (
5下載安裝包 wget http://nginx.org/download/nginx-1.16.0.tar.gz
6、解壓 tar zxvf ./nginx-1.16.0.tar.gz
7、進入解壓目錄 cd nginx-1.16.0/
8、安裝 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module sudo make sudo make install
9、啟動 /usr/local/nginx/sbin/nginx
=============================
第9步已經啟動了。可以通過 ps ef|grep nginx 可以看到有兩個進程。主進程和工作進程。
默認配置文件(nginx.conf)在 /usr/local/nginx/conf/nginx.conf
所以第九步的另一種啟動方式是(指定配置文件啟動) /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
由於默認配置文件路徑是 /usr/local/nginx/conf/nginx.conf 所以第九步簡寫了
停止nginx 我采用的 兩條命令 (查出進程 ps ef|grep nginx) 和 (殺掉進程 sudo kill -9 進程號)