鐢╪ginx鍋氫唬鐞嗘湇鍔″櫒涓婄綉

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了鐢╪ginx鍋氫唬鐞嗘湇鍔″櫒涓婄綉相关的知识,希望对你有一定的参考价值。

鏍囩锛?/p>

鐢╪ginx鍋氫唬鐞嗘湇鍔″櫒涓婄綉 

鐩墠鐜扮姸锛氬彧鏈?涓満鍣ㄨ兘涓婄綉(web),鍏朵粬鏈哄櫒涓嶈兘
鏂规硶锛氳兘涓婄綉鐨勫仛涓€涓唬鐞唚eb鏈嶅姟鍣ㄤ腑杞紝鍏朵粬鏈哄櫒杩炴帴瀹冨嵆鍙€傞噰鐢╪ginx

Nginx閰嶇疆濡備笅锛?br />
server{
        resolver x.x.x.x;
        listen 82;
        location / {
                proxy_pass http://$http_host$request_uri;
        }
}

娉ㄦ剰椤癸細
1. 涓嶈兘鏈塰ostname
2. 蹇呴』鏈塺esolver, 鍗砫ns锛屽嵆涓婇潰鐨剎.x.x.x锛屾崲鎴愪綘浠殑DNS鏈嶅姟鍣╥p鍗冲彲
3 . $http_host鍜?request_uri鏄痭ginx绯荤粺鍙橀噺锛屼笉瑕佹兂鐫€鏇挎崲浠栦滑锛屼繚鎸佸師鏍峰氨OK銆?br />
鏌ョ湅dns鏂规硶
cat /etc/resolv.conf

浠g悊浣跨敤

鍦ㄩ渶瑕佽闂缃戠殑鏈哄櫒涓婃墽琛屼互涓嬫搷浣滀箣涓€鍗冲彲锛?br />1. export http_proxy=http://yourproxyaddress锛歱roxyport
2. gedit ~/.bashrc  
    export http_proxy=http://yourproxyaddress锛歱roxyport
yourproxyaddress涔熷氨鏄綘鐨凬ginx鏈嶅姟鍣ㄧ殑ip浜嗭紝proxyport灏辨槸涓婇潰閰嶇疆涓殑82锛屽彲浠ユ牴鎹嚜宸辩殑闇€瑕佷慨鏀广€?br />

涓句緥锛?br />
  1. worker_processes 1;
  2. master_process off;
  3. daemon off;
  4. #pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 768;
  7. # multi_accept on;
  8. }
  9. http {
  10. include mime.types;
  11. default_type application/octet-stream;
  12. log_format main 鈥?remote_addr - $remote_user [$time_local] "$request" 鈥?/li>
  13. 鈥?status $body_bytes_sent "$http_referer" 鈥?/li>
  14. 鈥?$http_user_agent" "$http_x_forwarded_for"鈥?
  15. access_log /var/log/nginx/access.log;
  16. error_log /var/log/nginx/error.log;
  17. sendfile on;
  18. server {
  19. resolver 10.57.220.2;
  20. listen 82;
  21. access_log logs/host.access.log main;
  22. location / {
  23. proxy_pass http://$http_host$request_uri;
  24. }
  25. }
  26. }
  27. 绗?閮ㄥ垎:娴嬭瘯骞跺惎鍔╪ginx
    ulimit -SHn 51200
    /usr/local/webserver/nginx/sbin/nginx -t
    /usr/local/webserver/nginx/sbin/nginx

    绗?閮ㄥ垎:nginx鏃ュ織鍒囧壊鑴氭湰

以上是关于鐢╪ginx鍋氫唬鐞嗘湇鍔″櫒涓婄綉的主要内容,如果未能解决你的问题,请参考以下文章

2.3W瀛楋紝杩欏彲鑳芥槸鎶奛ginx璁插緱鏈€鍏ㄩ潰鐨勪竴绡囨枃绔犱簡锛屽缓璁敹钘忓鐢?/h1>

OMServer绠€浠?

鐢∟ginx绂佹鍥藉IP璁块棶鎴戠殑缃戠珯...

寰湇鍔″涔犱箣thrift浠嬬粛瀹夎

鎬庢牱鍒ゆ柇鐢ㄦ埛鏄惁鍦ㄧ嚎

椤圭洰鍥?: 鎼滅储寮曟搸钀ラ攢锛堝北鑹鸿銆婄綉缁滆惀閿€瀹炲姟銆嬪涔犲績寰楋級