安裝nginx需要提前安裝好一些必要的環境,就好比我們想要執行.py檔案,首先需要安裝直譯器一樣,是一種依賴關係。
依賴主要有三個庫:prce、zlib、openssl。其中prce是c語言編寫的正規表示式函式庫,nginx中使用它做路由匹配;zlib是通用的壓縮庫;openssl提供了豐富的加密解密的相關功能,nginx涉及到很多加密、解密的功能,如https中需要用到加密解密。
# 1、進入相應的安裝路徑,以 usr/local為例
cd /usr/local
wget ftp:
8.39
.tar.gz
# 3、解壓縮
tar -zxvf pcre-
8.39
.tar.gz
# 4、安裝
cd pcre-
8.39
.tar.gz
./configure
make
make install
注意:命令要按行拷貝執行,折行代表另外一條命令# 1、確認目錄 以/usr/local為例
# 3、解壓縮
tar -zxvf zlib-
1.2.11
.tar.gz
# 4、安裝
# 安裝步驟跟以上2個類似
# 1、切換路徑,以/usr/local為例
# 3、解壓縮
tar -zxvf openssl-
1.0.1t.tar.gz
# 4、安裝
cd openssl-
1.0.1t
./config
make
make install
# 1、確認路徑,以/usr/local為例
# 3、解壓縮
tar -zxvf nginx-
1.10
.1.tar.gz
# 4、安裝
cd nginx-
1.10.1.
/configure
make
make install
顯示如圖則說明配置正確/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
# 1、啟動
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
# 2、檢視程序
ps -ef | grep nginx
# 3、程序包含master process 和 worker process 就說明啟動成功
Nginx配置 未完待續
nginx的配置項可以大致分如下幾個部分 worker process number auto number 表示啟動的worker程序數 auto nginx程序自動檢測 檢視執行中的worker process程序 ps ax grep nginx配置nginx程序pid存放路徑 nginx程序...
nginx安裝與配置
1 安裝前,需要安裝的軟體包 yum y install gcc gcc c autoconf automake yum y install zlib zlib devel openssl openssl devel pcre pcre devel 2 安裝nginx 3 啟動與停止nginx 啟動...
nginx安裝與配置
wget 0.tar gz2,安裝 tar zxf nginx 1.14 0.tar gzcd nginx 1.14 0.configure prefix usr local nginx make make install3,配置 1,在index後面新增index.php 2,去掉location...