Nginx参数站点配置上的问题解决方案

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

创新互联,专注为中小企业提供官网建设、营销型网站制作、成都响应式网站建设公司、展示型网站建设、成都网站制作等服务,帮助中小企业通过网站体现价值、有效益。帮助企业快速建站、解决网站建设与网站营销推广问题。

 
 
 
  1. upstream.conf
  2. upstream bbs.linuxtone.com {
  3. server 192.168.1.4:8099;
  4. }

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. location ~ ^/NginxStatus/ {
  10. stub_status on;
  11. access_log off;
  12. }
  13. location / {
  14. root /date/wwwroot/linuxtone/;
  15. proxy_redirect off ;
  16. proxy_set_header Host $host;
  17. proxy_set_header X-Real-IP $remote_addr;
  18. proxy_set_header REMOTE-HOST $remote_addr;
  19. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  20. client_max_body_size 50m;
  21. client_body_buffer_size 256k;
  22. proxy_connect_timeout 30;
  23. proxy_send_timeout 30;
  24. proxy_read_timeout 60;
  25. proxy_buffer_size 256k;
  26. proxy_buffers 4 256k;
  27. proxy_busy_buffers_size 256k;
  28. proxy_temp_file_write_size 256k;
  29. proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
  30. proxy_max_temp_file_size 128m;
  31. proxy_pass http://bbs.linuxtone.com;
  32. }

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;
  13. }

以上就是对Nginx参数的详细介绍,希望大家有所帮助。

当前标题:Nginx参数站点配置上的问题解决方案
标题URL:http://www.shufengxianlan.com/qtweb/news20/64320.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联