In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to buffer the configuration of Nginx reverse proxy and server. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Nginx reverse proxy about the configuration of the back-end server. For the majority of network administrators, nginx reverse proxy is a compulsory course. Next, let's take a look at the relevant content. There are three back-end services, one for web content, one for forums, and one for documents.
When a request comes, the nginx proxy server looks at the url and directs the request to the corresponding server. This configuration also buffers the contents of the file service, but the contents of the forum and data downloads are not cached. This configuration also uses compression to better save memory.
# # #
# Calomel.org / etc/nginx.conf BEGIN
# # #
Pid / var/run/nginx.pid
User nginx nginx
Worker_processes 10
Events {
Worker_connections 1024
}
Http {
# # MIME types
# include / etc/nginx_mime.types
Default_type application/octet-stream
# # Size Limits
Client_body_buffer_size 128K
Client_header_buffer_size 128K
Client_max_body_size 1M
Large_client_header_buffers 1 1k
# # Timeouts
Client_body_timeout 60
Client_header_timeout 60
Expires 24h
Keepalive_timeout 60 60
Send_timeout 60
# # General Options
Ignore_invalid_headers on
Keepalive_requests 100
Limit_zone gulag $binary_remote_addr 5m
Recursive_error_pages on
Sendfile on
Server_name_in_redirect off
Server_tokens off
# # TCP options
Tcp_nodelay on
Tcp_nopush on
# # Compression
Gzip on
Gzip_buffers 16 8k
Gzip_comp_level 6
Gzip_http_version 1.0
Gzip_min_length 0
Gzip_types text/plain text/css image/x-icon application/x-perl
Application/x-httpd-cgi
Gzip_vary on
# # Log Format
Log_format main'$remote_addr $host $remote_user [$time_local]
"$request"'
'$status $body_bytes_sent "$http_referer" $http_user_agent "'
'' $gzip_ratio''
# # Proxy options
Proxy_buffering on
Proxy_cache_min_uses 3
Proxy_cache_path / usr/local/nginx/proxy_temp/ levels=1:2
Keys_zone=cache:10m inactive=10m max_size=1000M
Proxy_cache_valid any 10m
Proxy_ignore_client_abort off
Proxy_intercept_errors on
Proxy_next_upstream error timeout invalid_header
Proxy_redirect off
Proxy_set_header X-Forwarded-For $remote_addr
Proxy_connect_timeout 60
Proxy_send_timeout 60
Proxy_read_timeout 60
# # Backend servers (web1 is the primary and web2 will
Come up if web1 is down)
Upstream webbackend {
Server web1.domain.lan weight=10 max_fails=3 fail_timeout=30s
Server web2.domain.lan weight=1 backup
}
Server {
Access_log / var/log/nginx/access.log main
Error_log / var/log/nginx/error.log
Index index.html
Limit_conn gulag 50
Listen 127.0.0.1:80 default
Root / usr/local/nginx/html
Server_name _
# # Only requests to our Host are allowed
If ($host! ~ ^ (mydomain.com | www.mydomain.com) $) {
Return 444
}
# # Only allow these request methods
If ($request_method! ~ ^ (GET | HEAD | POST) $) {
Return 444
}
# # Only allow these file types to document root
Location / {
If ($request_uri ~ * (^\ / |\ .html |\ .jpg |\ .pl |\ .png |\ .css |\.
Ico | robots\ .txt) $) {
Break
}
Return 444
}
# # PROXY-Forum
Location / forum/ {
Proxy_pass http://forum.domain.lan/forum/;
}
# # PROXY-Data
Location / files/ {
Proxy_pass http://data.domain.lan/;
}
# # PROXY-Web
Location / {
Proxy_pass http://webbackend;
Proxy_cache cache
Proxy_cache_valid 200 24h
Proxy_cache_use_stale error timeout invalid_header updating
Http_500 http_502 http_503 http_504
Proxy_ignore_headers Expires Cache-Control
}
# # All other errors get the generic error page
Error_page 400 401 402 403 404 405 406 407 408 409 410 411
412 413 414 415 416 417
500 501 502 503 504 505 506 507 / error_page.html
Location / error_page.html {
Internal
}
}
}
#
# # #
# Calomel.org / etc/nginx.conf END
# # #
The above content is how to buffer the configuration of Nginx reverse proxy and server. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.