In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The following brings you a detailed explanation of nginx reverse proxy project adding load balancing and static and dynamic separation configuration, hoping to bring some help to you in practical application. Load balancing involves more things, there are not many theories, and there are many books on the Internet. Today, we will use the accumulated experience in the industry to do an answer.
Nginx reverse proxy multiple projects, adding load balancing and static and dynamic separation configuration
# user nobody
Worker_processes 4
Error_log logs/error.log info
Pid logs/nginx.pid
Worker_rlimit_nofile 65535
Events {
Worker_connections 65535
}
Http {
Include mime.types
Default_type application/octet-stream
Log_format main'$remote_addr-$remote_user [$time_local] "$request"'
'$status $body_bytes_sent "$http_referer"'
'"$http_user_agent"$http_x_forwarded_for"'
Server_names_hash_bucket_size 128
Client_header_buffer_size 32k
Large_client_header_buffers 4 32k
Client_max_body_size 300m
Sendfile on
Tcp_nopush on
Keepalive_timeout 60
Tcp_nodelay on
Server_tokens off
Client_body_buffer_size 512k
Proxy_connect_timeout 5
Proxy_send_timeout 60
Proxy_read_timeout 5
Proxy_buffer_size 16k
Proxy_buffers 4 64k
Proxy_busy_buffers_size 128k
Proxy_temp_file_write_size 128k
Client_header_timeout 3m
Client_body_timeout 3m
Send_timeout 3m
Access_log logs/access.log main
Gzip on
# load balancing
Upstream bsxm {
Ip_hash
Server 192.168.1.193:8080
}
# specify static page path
Server {
Listen 80
Server_name 192.168.1.193
Root C:\ webapps\ bsxmgw\ pages
Index index.html index.htm
# load the static file because it is configured in the reverse proxy below, and it is selected here according to the requirements
# location ~ ^ / (p_w_picpaths | javascript | js | css | flash | media | static) / {
# root C:\ webapps\ bsxmgw
# access_log off
# expires 30d; # all static files are cached for 30 days
#}
# reverse proxy configuration
Location / {
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
# Pure reverse proxy configuration
# location / webapps/
# {
# proxy_pass http://192.168.1.193:8080;
#}
# load balancing
Location. (jsp | action) $
{
Proxy_pass http://bsxm;
# client_max_body_size 1000m
}
Location. (gif | jpg | jpeg | png | bmp | swf | flv) $
{
Expires 30dbot # all static files are cached for 30 days
}
Location. (js | css)? $
{
Expires 1h
}
}
# reverse proxy Engineering
Location / b/ {
Proxy_pass http://192.168.1.193:8080/b/;
# root C:\ webapps\ b; these configurations can be enabled when the project cannot be accessed using pure reverse.
# proxy_redirect http://host:8080 http://$host:$server_port;
# index index.html index.htm
}
# reverse proxy Engineering
Location / a/ {
Proxy_pass http://192.168.1.193:8080/a/;
# root C:\ webapps\ a
# proxy_redirect http://host:8080 http://$host:$server_port;
# index index.html index.htm
}
# access address is http://localhost/a http://localhost/b
# error_page 404 / 404.html
# redirect server error pages to the static page / 50x.html
#
Error_page 500 502 503 504 / 50x.html
Location = / 50x.html {
Root html
}
After reading the above detailed explanation about nginx reverse proxy project adding load balancing and static and dynamic separation configuration, if you have anything else you need to know, you can find what you are interested in in the industry information or find our professional and technical engineer to answer, the technical engineer has more than ten years of experience in the industry.
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.