瀹夎Nginx

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了瀹夎Nginx相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/nbsp' title='nbsp'>nbsp   div   瀹夎閰嶇疆   fast   鍛戒护   闃块噷   span   

Nginx WEB 鍏ラ棬绠€浠?/p>

ginx [engine x]鏄?Igor Sysoev 缂栧啓鐨勪竴涓?HTTP 鍜屽弽鍚戜唬鐞嗘湇鍔″櫒锛屽彟澶栧畠涔熷彲浠?br>浣滀负閭欢浠g悊鏈嶅姟鍣ㄣ€?瀹冨凡缁忓湪浼楀娴侀噺寰堝ぇ鐨勪縿缃楁柉缃戠珯涓婁娇鐢ㄤ簡寰堥暱鏃堕棿锛岃繖浜涚綉绔?br>鍖呮嫭 Yandex銆丮ail.Ru銆乂Kontakte锛屼互鍙?Rambler銆?br>鎹?Netcraft 缁熻锛屽湪 2012 骞?8 鏈堜唤锛屼笘鐣屼笂鏈€绻佸繖鐨勭綉绔欎腑鏈?11.48%浣跨敤 nginx
浣滀负鍏舵湇鍔″櫒鎴栬€呬唬鐞嗘湇鍔″櫒銆傜洰鍓嶄簰鑱旂綉涓绘祦鍏徃 360銆佺櫨搴︺€佹柊娴€佽吘璁€侀樋閲岀瓑閮藉湪
浣跨敤 nginx 浣滀负鑷繁鐨?web 鏈嶅姟鍣ㄣ€?br>Nginx 鐢卞唴鏍稿拰妯″潡缁勬垚锛屽叾涓紝 鍐呮牳鐨勮璁¢潪甯稿井灏忓拰绠€娲侊紝瀹屾垚鐨勫伐
浣滀篃闈炲父绠€鍗曪紝浠呬粎閫氳繃鏌ユ壘閰嶇疆鏂囦欢灏嗗鎴风璇锋眰鏄犲皠鍒颁竴涓?br>location block锛坙ocation 鏄?Nginx 閰嶇疆涓殑涓€涓寚浠わ紝鐢ㄤ簬 URL
鍖归厤锛夛紝鑰屽湪杩欎釜 location 涓墍閰嶇疆鐨勬瘡涓寚浠ゅ皢浼氬惎鍔ㄤ笉鍚岀殑妯?br>鍧楀幓瀹屾垚鐩稿簲鐨勫伐浣溿€?/p>

 

Nginx 鐩稿浜?Apache 浼樼偣锛?br>1) 楂樺苟鍙戝搷搴旀€ц兘闈炲父濂斤紝瀹樻柟 Nginx 澶勭悊闈欐€佹枃浠跺苟鍙?5w/s
2) 鍙嶅悜浠g悊鎬ц兘闈炲父濂姐€傦紙鍙敤浜庤礋杞藉潎琛★級
3) 鍐呭瓨鍜?cpu 鍗犵敤鐜囦綆銆傦紙涓?Apache 鐨?1/5-1/10锛?br>4) 鍔熻兘杈?Apache 灏戯紙甯哥敤鍔熻兘鍧囨湁锛?br>5) 瀵?php 鍙娇鐢?cgi 鏂瑰紡鍜?fastcgi 鏂瑰紡銆?/p>

 

Nginx WEB 瀹夎閰嶇疆
棣栧厛闇€瑕佸畨瑁?pcre 搴擄紝鐒跺悗鍐嶅畨瑁?Nginx锛?br>#瀹夎 pcre 鏀寔 rewrite 搴?涔熷彲浠ュ畨瑁呮簮鐮侊紝娉?瀹夎婧愮爜鏃讹紝鎸囧畾 pcre 璺緞涓鸿В鍘?br>婧愮爜鐨勮矾寰勶紝鑰屼笉鏄紪璇戝悗鐨勮矾寰勶紝鍚﹀垯浼氭姤閿欍€?br>锛坢ake[1]: *** [/usr/local/pcre/Makefile] Error 127 閿欒锛?/p>

 

 

yum install pcre-devel pcre -y
#涓嬭浇 Nginx 婧愮爜鍖?cd /usr/src ;wget -c http://nginx.org/download/nginx-1.4.2.tar.gz

#瑙e帇 Nginx 婧愮爜鍖?tar -xzf nginx-1.4.2.tar.gz
#杩涘叆瑙e帇鐩綍锛岀劧鍚?sed 淇敼 Nginx 鐗堟湰淇℃伅涓?WS
cd nginx-1.4.2 ; sed -i -e 鈥?/span>s/1.4.2//g鈥?/span> -e 鈥?/span>s/nginx//WS/g鈥?/span> -e
鈥?/span>s/"NGINX"/"WS"/g鈥?/span> src/core/nginx.h
#棰勭紪璇?Nginx

useradd www ;./configure --user=www --group=www
--prefix=/usr/local/nginx --with-http_stub_status_module
--with-http_ssl_module
#.configure 棰勭紪璇戞垚鍔熷悗锛屾墽琛?make 鍛戒护杩涜缂栬瘧
make
#make 鎵ц鎴愬姛鍚庯紝鎵ц make install 姝e紡瀹夎
make install
璧勬簮鐢?www.eimhe.com 缇庢渤瀛︿範鍦ㄧ嚎鏀堕泦鍒嗕韩
#鑷 Nginx 瀹夎瀹屾瘯


/usr/local/nginx/sbin/nginx -t 妫€鏌?nginx 閰嶇疆鏂囦欢鏄惁姝g‘锛岃繑鍥?OK 鍗虫纭€?[[email protected] ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[[email protected] ~]#
鐒跺悗鍚姩 nginx锛?/span>/usr/local/nginx/sbin/nginx 鍥炶溅鍗冲彲銆傛煡鐪嬭繘绋嬫槸鍚﹀凡鍚姩锛?

[[email protected] ~]# ps -ef |grep nginx
nobody 5381 30285 0 May16 ? 00:04:31 nginx: worker process
root 30285 1 0 2014 ? 00:00:00 nginx: master process
/usr/local/nginx/sbin/nginx
root 32260 32220 0 12:34 pts/0 00:00:00 grep nginx

 








以上是关于瀹夎Nginx的主要内容,如果未能解决你的问题,请参考以下文章

nginx瀹夎

Nginx锛欳entOS7瀹夎Nginx

CentOS6.8瀹夎Nginx

Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段

python 瀹夎pytorch 鍙?瀹夎澶辫触瑙e喅鍔炴硶

Windows 2016 瀹归尟绉昏綁鍙㈤泦瀹夎 鍙㈤泦瀹夎