Nginx學(xué)習(xí)筆記(一)
創(chuàng)新互聯(lián)是專業(yè)的臺(tái)江網(wǎng)站建設(shè)公司,臺(tái)江接單;提供網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè),網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行臺(tái)江網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!一、Nginx的特點(diǎn)與作用
Nginx可以更快地響應(yīng)請(qǐng)求。
Web和反向代理服務(wù)器
支持非常多的服務(wù)器軟件特性
處理靜態(tài)資源
用作反向代理
用作負(fù)載均衡
二、Nginx編譯安裝
2.1 準(zhǔn)備工作
操作系統(tǒng):CentOS7.3 IP地址:10.0.0.110
yum install -y gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel2.2 添加用戶
useradd -r nginx2.3 編譯安裝
./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_dav_module --with-http_stub_status_module --with-threads --with-file-aio
make && make install
三、簡(jiǎn)單web站點(diǎn)配置
3.1設(shè)置環(huán)境變量
vi /etc/profile.d/nginx.sh #在最后一行加入下面字段
export PATH="$PATH:/usr/local/nginx/sbin/"
3.2啟動(dòng)nginx
nginx
3.3配置nginx的web站點(diǎn)
說明:站點(diǎn)A:www.huwho.cn URL映射的根目錄:/nginx/web
站點(diǎn)B:blog.huwho.cn URL映射的根目錄:/nginx/blog
編譯配置文件
vi /etc/nginx.conf
站點(diǎn)A配置段如下:
server { listen 80; server_name www.huwho.cn; root /nginx/web; index index.html; #charset koi8-r; #access_log logs/host.access.log main; location /p_w_picpaths/ { root /nginx/; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }站點(diǎn)B配置段如下:
server { listen 80; server_name blog.huwho.cn; root /nginx/blog; index index.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }3.4測(cè)試nginx語法
[root@pxe31 nginx]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful3.5重載nginx
[root@pxe31 nginx]# nginx -s reload3.6站點(diǎn)目錄以及文件配置
mkdir /nginx/{web,blog}
echo www.huwho.cn > /nginx/web/index.html
echo blog.huwho.cn > /nginx/blog/index.html
3.7修改windows的hosts文件
3.8訪問測(cè)試
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)站標(biāo)題:Nginx學(xué)習(xí)筆記(一)-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://chinadenli.net/article46/cdpshg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、自適應(yīng)網(wǎng)站、網(wǎng)站設(shè)計(jì)、電子商務(wù)、網(wǎng)站導(dǎo)航、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容