Nginx single-host server Load balancer test configuration file mac OS x

Source: Internet
Author: User

You need nginx as the server to create a networked device. In this way, load balancing is nothing to worry about.


# User nobody; worker_processes 1; error_log/Users/lingyun/www/log/error. log; events {worker_connections 1024;} http {include mime. types; default_type application/octet-stream; # log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request"' # '$ status $ response "$ 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; # upstream settings. Port 80 is listened to by default, and the address provided to the client is also the upstream myproject {server 127.0.0.1: 8000; server 127.0.0.1: 8001;} server {listen 80; server_name localhost; location/{proxy_pass http: // myproject ;}# Real web server configuration. For simplicity, the two web servers are configured in the same path, except the port. These addresses do not need to be opened to the client server {listen 8000; server_name localhost; location/{root/Users/lingyun/www/ko32example/site; index index.html index.htm;} location ~ \. Php $ {root/Users/lingyun/www/farm/public; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/Users/lingyun/www/farm/public $ fastcgi_script_name; include fastcgi_params ;}} server {listen 8001; server_name localhost; location/{root/Users/lingyun/www/ko32example/site; index index.html index.htm;} location ~ \. Php $ {root/Users/lingyun/www/farm/public; fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; fastcgi_param SCRIPT_FILENAME/Users/lingyun/www/farm/public $ fastcgi_script_name; include fastcgi_params ;}}}

When multiple machines start the web server, modify the configuration (not tested yet ). Now you just need to run the streaming on a single machine.

Environment installation-related google Baidu :)

Browser Verification

Http: // localhost/test. php

Http: // localhost: 8000/test. php

Http: // localhost: 8001/test. php

Returns the content of phpinfo ().

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.