Ubuntu 安裝nginx指定版本

官方下載地址:http://nginx.org/en/download.htmlhtml

configure配置文件詳解:http://nginx.org/en/docs/configure.htmlnginx

安裝gcc g++的依賴庫ui

sudo apt-get install build-essential
sudo apt-get install libtool

安裝pcre依賴庫(http://www.pcre.org/spa

sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev

安裝zlib依賴庫(http://www.zlib.net.net

sudo apt-get install zlib1g-dev

安裝SSL依賴庫(16.04默認已經安裝了)code

sudo apt-get install openssl

安裝Nginxhtm

#下載穩定版本:
wget http://nginx.org/download/nginx-1.16.0.tar.gz
#
解壓: tar -zxvf nginx-1.16.0.tar.gz #進入解壓目錄: cd nginx-1.16.0 #配置: ./configure --prefix=/usr/local/nginx #編譯而且安裝: make && make install
#啓動: 1. sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 注意:-c 指定配置文件的路徑,不加的話,nginx會自動加載默認路徑的配置文件,能夠經過-h查看幫助命令。
2. cd /usr/local/nginx
  ./sbin/nginx
#查看進程: ps -ef | grep nginx

  root@MACHENIKE:/usr/local/nginx# ps -ef | grep nginx
  root 21989 2737 0 16:32 ? 00:00:00 nginx: master process ./sbin/nginx
  nobody 21990 21989 0 16:32 ? 00:00:00 nginx: worker process
  root 22165 5672 0 16:37 pts/0 00:00:00 grep --color=auto nginxblog

  #根據信號量關閉和重啓nginx:進程

  例:kill -INT 21989 ssl

      至關於重啓nginx -> kill -HUP 21989 

 

參考:https://www.cnblogs.com/EasonJim/p/7806879.html

相關文章
相關標籤/搜索