Nginx學習筆記(一)
創(chuàng)新互聯(lián)是專業(yè)的臺江網站建設公司,臺江接單;提供網站建設、成都網站建設,網頁設計,網站設計,建網站,PHP網站建設等專業(yè)做網站服務;采用PHP框架,可快速的進行臺江網站開發(fā)網頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網站,專業(yè)的做網站團隊,希望更多企業(yè)前來合作!一、Nginx的特點與作用
Nginx可以更快地響應請求。
Web和反向代理服務器
支持非常多的服務器軟件特性
處理靜態(tài)資源
用作反向代理
用作負載均衡
二、Nginx編譯安裝
2.1 準備工作
操作系統(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
三、簡單web站點配置
3.1設置環(huán)境變量
vi /etc/profile.d/nginx.sh #在最后一行加入下面字段
export PATH="$PATH:/usr/local/nginx/sbin/"
3.2啟動nginx
nginx
3.3配置nginx的web站點
說明:站點A:www.huwho.cn URL映射的根目錄:/nginx/web
站點B:blog.huwho.cn URL映射的根目錄:/nginx/blog
編譯配置文件
vi /etc/nginx.conf
站點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; }站點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測試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站點目錄以及文件配置
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訪問測試
另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網站標題:Nginx學習筆記(一)-創(chuàng)新互聯(lián)
網址分享:http://aaarwkj.com/article46/cdpshg.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供定制網站、自適應網站、網站設計、電子商務、網站導航、網站排名
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)