Home >Backend Development >PHP Tutorial >Using Niginx for load balancing under Linux
This article is a follow-up to the previous article. Three tomcat servers and one nginx server are installed on the Tencent cloud server. The nginx server is used to balance the access of the three tomcat servers. Getting started is still very simple. The key is to pay attention to some details. And improve subsequent learning
Enter conf/nginx.conf under the installation package. NoteIt must be under the installation package (mine is under installnginx), not conf under the source code. Modify the file to:
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"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; <strong> upstream nginxBalance { server 123.206.75.62:8080 weight=1; server 123.206.75.62:8180 weight=1; server 123.206.75.62:8280 weight=1; }</strong> server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { <strong>proxy_pass http://nginxBalance;</strong> root html; index index.html index.htm; }
OK, the basic load balancing configuration is completed, and the rest is to learn more in depth
The above introduces the use of Niginx for load balancing under Linux, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.