真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

nginx-1.12.0版本(編譯安裝)-自定義安裝路徑

nginx-1.12.0版本(編譯安裝)-自定義安裝路徑

安裝路徑:/application/nginx-1.12.0

創(chuàng)新互聯(lián)不只是一家網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司;我們對(duì)營(yíng)銷、技術(shù)、服務(wù)都有自己獨(dú)特見解,公司采取“創(chuàng)意+綜合+營(yíng)銷”一體化的方式為您提供更專業(yè)的服務(wù)!我們經(jīng)歷的每一步也許不一定是最完美的,但每一步都有值得深思的意義。我們珍視每一份信任,關(guān)注我們的網(wǎng)站制作、成都做網(wǎng)站質(zhì)量和服務(wù)品質(zhì),在得到用戶滿意的同時(shí),也能得到同行業(yè)的專業(yè)認(rèn)可,能夠?yàn)樾袠I(yè)創(chuàng)新發(fā)展助力。未來將繼續(xù)專注于技術(shù)創(chuàng)新,服務(wù)升級(jí),滿足企業(yè)一站式營(yíng)銷型網(wǎng)站建設(shè)需求,讓再小的成都品牌網(wǎng)站建設(shè)也能產(chǎn)生價(jià)值!

1.前期準(zhǔn)備

安裝編譯需要的gcc和gcc-c++

yum install -y gcc gcc-c++

nginx依賴

pcre-devel、openssl-devel、zlib-devel

yum install -y pcre pcre-devel openssl openssl-devel zlib zlib-devel

創(chuàng)建用戶nginx,以該用戶的身份執(zhí)行nginx

useradd -s /bin/false -M nginx

下載nginx源碼包并解壓到當(dāng)前目錄

cd /tools
wget http://nginx.org/download/nginx-1.12.0.tar.gz
tar -zxf nginx-1.12.0.tar.gz

 

2.nginx編譯安裝

生成Makefile文件

cd nginx-1.12.0
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.12.0/ --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre

編譯源代碼并安裝

make && make install

 

3.后期結(jié)尾

給nginx-1.12.0創(chuàng)建軟鏈接去掉末尾的版本號(hào)

ln -s /application/nginx-1.12.0/ /application/nginx

添加環(huán)境變量

創(chuàng)建nginx命令軟鏈接到環(huán)境變量

ln -s /application/nginx/sbin/* /usr/local/sbin/

 

4.配置nginx開啟php支持

在server段中開啟php支持

cd /application/nginx
vim conf/nginx.conf

找到如下內(nèi)容,刪除注釋字符,并將倒數(shù)第二行的 /scripts 替換為 $document_root

修改前

#location ~ \.php$ {

#    root           html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

修改后

location ~ \.php$ {

root           html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

該段代碼在server中的位置:

server {

    listen       80;

    server_name  localhost;

    location / {

        root   html;

        index  index.php index.html index.htm;

    }

    location ~ \.php$ {

    root           html;

    fastcgi_pass   127.0.0.1:9000;

    fastcgi_index  index.php;

    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

    include        fastcgi_params;

    }

}

注意:location ~ \.php$ {}塊中root的值和location / {}塊中root的值需要一致

 

5.常用命令

檢查配置文件

nginx -t

指定其他配置文件啟動(dòng)nginx

nginx -c /application/nginx/conf/nginx.conf.bak

啟動(dòng)nginx

nginx

停止nginx

nginx -s stop

重啟nginx

nginx -s reload

參數(shù)解釋

-s stop 快速停止nginx

-s quit 平滑停止nginx

-s reopen 重新打開日志文件

-s reload 平滑重載所有配置

 

6.目錄介紹

 [root@www nginx]# tree
.
├── conf  #配置文件目錄
│   ├── fastcgi.conf
│   ├── fastcgi.conf.default
│   ├── fastcgi_params
│   ├── fastcgi_params.default  #fastcgi *配合php
│   ├── koi-utf
│   ├── koi-win
│   ├── mime.types  #mime 媒體類型
│   ├── mime.types.default
│   ├── nginx.conf  #nginx主配置文件
│   ├── nginx.conf.default
│   ├── scgi_params
│   ├── scgi_params.default
│   ├── uwsgi_params
│   ├── uwsgi_params.default
│   └── win-utf
├── html  #默認(rèn)站點(diǎn)目錄
│   ├── 50x.html
│   └── index.html
├── logs  #訪問日志、錯(cuò)誤日志、pid文件目錄
│   ├── access.log  #訪問日志
│   ├── error.log  #錯(cuò)誤日志
│   └── nginx.pid  #pid文件
└── sbin  #命令目錄
└── nginx  #nginx命令文件

 


網(wǎng)站標(biāo)題:nginx-1.12.0版本(編譯安裝)-自定義安裝路徑
本文URL:http://weahome.cn/article/ppgjoc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部