溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何解決Nginx參數(shù)站點(diǎn)配置上的問(wèn)題

發(fā)布時(shí)間:2021-11-18 10:59:40 來(lái)源:億速云 閱讀:118 作者:柒染 欄目:web開(kāi)發(fā)

如何解決Nginx參數(shù)站點(diǎn)配置上的問(wèn)題,針對(duì)這個(gè)問(wèn)題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問(wèn)題的小伙伴找到更簡(jiǎn)單易行的方法。

Nginx參數(shù)有很多經(jīng)典的語(yǔ)句,其中upstream.conf 配置文件就是一個(gè)很好的例子,下面我們就看看如何才能好的使用這些語(yǔ)句呢?下面的文章就會(huì)對(duì)你有很好的幫助,尤其是在了解Nginx參數(shù)上的問(wèn)題。

upstream.conf  upstream bbs.linuxtone.com {  server 192.168.1.4:8099;  }

Nginx參數(shù)站點(diǎn)配置文件

  1. bbs.linuxtone.conf  

  2. server  

  3. {  

  4. listen 80;  

  5. server_name bbs.linuxtone.conf;  

  6. charset GB2312;  

  7. index index.html index.htm;  

  8. root /date/wwwroot/linuxtone/;  

  9.  

  10. location ~ ^/NginxStatus/ {  

  11. stub_status on;  

  12. access_log off;  

  13. }  

  14. location / {  

  15. root /date/wwwroot/linuxtone/;  

  16. proxy_redirect off ;  

  17. proxy_set_header Host $host;  

  18. proxy_set_header X-Real-IP $remote_addr;  

  19. proxy_set_header REMOTE-HOST $remote_addr;  

  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  

  21. client_max_body_size 50m;  

  22. client_body_buffer_size 256k;  

  23. proxy_connect_timeout 30;  

  24. proxy_send_timeout 30;  

  25. proxy_read_timeout 60;  

  26. proxy_buffer_size 256k;  

  27. proxy_buffers 4 256k;  

  28. proxy_busy_buffers_size 256k;  

  29. proxy_temp_file_write_size 256k;  

  30. proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;  

  31. proxy_max_temp_file_size 128m;  

  32. proxy_pass http://bbs.linuxtone.com;  


Nginx參數(shù)都有所調(diào)整.目的是解決代理過(guò)程中出現(xiàn)的一些502 499錯(cuò)誤

  1. #Add expires header for static content  

  2. location ~* \.(jpg|jpeg|gif|png|swf)$ {  

  3. if (-f $request_filename) {  

  4. root /date/wwwroot/linuxtone/;  

  5. expires 1d;  

  6. break;  

  7. }  

  8. }  

  9. log_format access '$remote_addr - $remote_user [$time_local] "$request" '  

  10. '$status $body_bytes_sent "$http_referer" '  

  11. '"$http_user_agent" $http_x_forwarded_for';  

  12. access_log /exp/Nginxlogs/bbs.linuxtone_access.log access;  

關(guān)于如何解決Nginx參數(shù)站點(diǎn)配置上的問(wèn)題問(wèn)題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒(méi)有解開(kāi),可以關(guān)注億速云行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI