如何解决Nginx参数站点配置上的问题

发布时间:2021-11-18 10:59:40 作者:柒染
来源:亿速云 阅读:112

如何解决Nginx参数站点配置上的问题,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

Nginx参数有很多经典的语句,其中upstream.conf 配置文件就是一个很好的例子,下面我们就看看如何才能好的使用这些语句呢?下面的文章就会对你有很好的帮助,尤其是在了解Nginx参数上的问题。

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

Nginx参数站点配置文件

  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参数都有所调整.目的是解决代理过程中出现的一些502 499错误

  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;  

关于如何解决Nginx参数站点配置上的问题问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注亿速云行业资讯频道了解更多相关知识。

推荐阅读:
  1. 如何在Nginx中实现多站点配置
  2. nginx配置多个站点共用80端口的解决方法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

nginx

上一篇:如何理解Ext JS控件的扩展

下一篇:如何重新安装TCP/IP协议

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》