Nginx+Apache environment test load balancing

First prepare a few virtual machines and write down the corresponding configuration 192.168.1.54 ————————>ubuntu11.4+nginx0.8.54 +php5.3.5 +msyql5.1 (load balancing server, php and mysql are not used here) 192.168.1.53 ————————>centos5.5+ apache+php5.3.5+mysql5.1 (web server) 192.168.1.55 ————————>centos5.5+ apache+php5.3.5+mysql5.1 (web server) 1. Simply access different servers according to the request suffix name, modify /etc/nginx/site_available/default It is required that all visits to *.php point to 1.55, and all visits to *.html point to 1.53 server { listen 80; index index.php index.html index.htm; server_namewww.test.com; # key configuration location ~ \.php$ {   proxy_pass http://192.168.1.55; location ~ \.html$ { proxy_pass http://192.168.1.53; } 2. Simple access to different servers by domain name, it seems to be called reverse proxy The nginx configuration of this version is scattered in several files, among which /etc/nginx/nginx.conf is configured as a global configuration, and the /etc/nginx/site_available/default file contains the configuration information of each virtual server, and then /etc /nginx/nginx.conf is included in /etc/nginx/site_available/default Here we have two domain names img.test.com and www.test.com, both point to 192.168.1.54, all visits go to 192.168.1.54 , then 192.168.1.54 Then access different back-end servers according to different domain names, all visits to img.test.com are directed to 192.168.1.53, and all visits to www.test.com are directed to 192.168.1.55 Approach: Configure…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索