Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of site configuration of Nginx parameters

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

How to solve the problem of Nginx parameter site configuration, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

The Nginx parameter has many classic statements, of which the upstream.conf configuration file is a good example. Let's see how to use these statements well. The following articles will be of great help to you, especially when it comes to understanding Nginx parameters.

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

Nginx parameter site profile

Bbs.linuxtone.conf

Server

{

Listen 80

Server_name bbs.linuxtone.conf

Charset GB2312

Index index.html index.htm

Root/ date/wwwroot/linuxtone/

Location ~ ^ / NginxStatus/ {

Stub_status on

Access_log off

}

Location / {

Root/ date/wwwroot/linuxtone/

Proxy_redirect off

Proxy_set_header Host $host

Proxy_set_header X-Real-IP $remote_addr

Proxy_set_header REMOTE-HOST $remote_addr

Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for

Client_max_body_size 50m

Client_body_buffer_size 256k

Proxy_connect_timeout 30

Proxy_send_timeout 30

Proxy_read_timeout 60

Proxy_buffer_size 256k

Proxy_buffers 4 256k

Proxy_busy_buffers_size 256k

Proxy_temp_file_write_size 256k

Proxy_next_upstream error timeout invalid_header http_500 http_503 http_404

Proxy_max_temp_file_size 128m

Proxy_pass http://bbs.linuxtone.com;

}

The parameters of Nginx have been adjusted. The purpose is to solve some 502 499 errors in the agent process.

# Add expires header for static content

Location *\. (jpg | jpeg | gif | png | swf) ${

If (- f $request_filename) {

Root/ date/wwwroot/linuxtone/

Expires 1d

Break

}

}

Log_format access'$remote_addr-$remote_user [$time_local] "$request"'

'$status $body_bytes_sent "$http_referer"'

'"$http_user_agent" $http_x_forwarded_for'

Access_log / exp/Nginxlogs/bbs.linuxtone_access.log access

}

This is the answer to the question on how to solve the problem of Nginx parameter site configuration. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report