Nginx ("enginex") is a high-performance HTTP and reverse proxy server and an IMAP/POP3/SMTP proxy server. Nginx was developed by the Rambler.ru site with the highest access volume in Russia as IgorSysoev. it has been running on this site for more than two and a half years. Igor publishes source code in the form of a class BSD license. Nginx Chinese Wiki: [url] http://wiki.codemongers.com/N Nginx ("engine x") is a high-performance HTTP and reverse proxy server, is also an IMAP/POP3/SMTP proxy server. Nginx was developed by the Rambler.ru site with the highest access volume in Russia as Igor Sysoev. it has been running on this site for more than two and a half years. Igor publishes source code in the form of a class BSD license. Nginx Chinese Wiki: [url] http://wiki.codemongers.com/nginxchs#/url%1#install pcrelibrary
Tar jxvf pcre-7.9.tar.bz2
Cd pcre-7.9/
./Configure
Make
Make install2. install nginx
Tar zxvf nginx-0.6.36.tar.gz
Cd nginx-0.6.36/
./Configure -- user = www -- group = www -- prefix =/usr/local/nginx -- with-http_stub_status_module
Make
Make install3. run nginx
/Usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx. conf4, Configure nginx Reverse proxy
The loading.abc.com and loading.xyz.com domain names all point to the IP address of the nginx server, the user accesses the [url] http://loading.abc.com [/url], load balancing its load to 192.168.1.2: 80, 192.168.1.3: 80, 192.168.1.4: 80, 192.168.1.5: 80 four servers. The user accesses the [url] http://loading.xyz.com [/url] and balances its load to ports 8080, 8081, and 8082 on the 192.168.1.7 server. The following is the configuration file nginx. conf: user www; worker_processes 10; # error_log logs/error. log;
# Error_log logs/error. log notice;
# Error_log logs/error. log info; # pid logs/nginx. pid; # Maximum file descriptor
Worker_rlimit_nofile 51200; events {
Use epoll;
Worker_connections 51200;
} Http {
Include conf/mime. types;
Default_type application/octet-stream;
Keepalive_timeout 120;
Tcp_nodelay on; upstream abc {
Server 192.168.1.2: 80;
Server 192.168.1.3: 80;
Server 192.168.1.4: 80;
Server 192.168.1.5: 80;
} Upstream xyz {
Server 192.168.1.7: 8080;
Server 192.168.1.7: 8081;
Server 192.168.1.7: 8082;
} Server {
Listen 80;
Server_name loading.abc.com;
Location /{
Proxy_pass [url] http: // abc [/url];
Proxy_set_header Host $ host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
} Log_format abc '$ remote_addr-$ remote_user [$ time_local] $ request'
'"$ Status" $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "';
Access_log/www/logs/abc. log abc;
} Server {
Listen 80;
Server_name loading.xyz.com;
Location /{
Proxy_pass [url] http: // xyz [/url];
Proxy_set_header Host $ host;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
} Log_format xyz '$ remote_addr-$ remote_user [$ time_local] $ request'
'"$ Status" $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "';
Access_log/www/logs/xyz. log xyz;
}
}
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