80-Port Coping strategy nginx Reverse proxy for WIN2003 super fool configuration _nginx

Source: Internet
Author: User
Tags nginx reverse proxy

Win under the latest version of son: nginx-0.8.31
Download Address:http://sysoev.ru/nginx/nginx-0.8.31.zip
After the download to any location, and then modify the inside of the nginx.conf and add proxy.conf after the start Nginx.exe can!

Proxy.conf content:

Copy Code code as follows:

Proxy_redirect off;
Proxy_set_header Host $host;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header remote-host $remote _addr;
Proxy_set_header x-forwarded-for $remote _addr;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Client_max_body_size 10m;
Client_body_buffer_size 128k;

# client_body_temp_path/var/nginx/client_body_temp;

Proxy_connect_timeout 90;
Proxy_send_timeout 90;
Proxy_read_timeout 90;
#proxy_send_lowat 12000;

Proxy_buffer_size 32k;
Proxy_buffers 4 32k;
Proxy_busy_buffers_size 64k;
Proxy_temp_file_write_size 64k;

# proxy_temp_path/var/nginx/proxy_temp;

Proxy_ignore_client_abort on;

Proxy_next_upstream Error timeout Invalid_header http_500 http_503 http_404;

Proxy_max_temp_file_size 128m;

Nginx.conf content:
Copy Code code as follows:

#user nobody;
Worker_processes 1;

#error_log Logs/error.log;
#error_log Logs/error.log Notice;
#error_log Logs/error.log Info;

#pid Logs/nginx.pid;
Events {
Worker_connections 1024;
}
HTTP {
Include Mime.types;
Include proxy.conf;
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;

server {
Listen 80;
server_name localhost;

#charset Koi8-r;

#access_log Logs/host.access.log Main;

Location/{
root HTML;
Index index.html index.htm;
}

#error_page 404/404.html;

# REDIRECT Server error pages to the static page/50x.html
#
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}

# Proxy The PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# Proxy_pass http://127.0.0.1;
#}

# Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root HTML;
# Fastcgi_pass 127.0.0.1:9000;
# Fastcgi_index index.php;
# Fastcgi_param Script_filename/scripts$fastcgi_script_name;
# include Fastcgi_params;
#}

# Deny access to. htaccess files, if Apache ' s document Root
# concurs with Nginx ' s one
#
#location ~/\.ht {
# Deny All;
#}
}
# Another virtual host using mix of ip-, name-, and port-based configuration
#
#server {
# Listen 8000;
# Listen somename:8080;
# server_name somename alias Another.alias;

# location/{
# root HTML;
# index index.html index.htm;
# }
#}
# HTTPS Server
#
#server {
# Listen 443;
# server_name localhost;

# SSL on;
# ssl_certificate Cert.pem;
# Ssl_certificate_key Cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers all:! Adh:! Export56:rc4+rsa:+high:+medium:+low:+sslv2:+exp;
# ssl_prefer_server_ciphers on;

# location/{
# root HTML;
# index index.html index.htm;
# }
#}
# Other do not have to pipe, as long as the right side place can, the most important is the following line, according to fill on it! One station, one station to a port, the port do not repeat, otherwise your IIS inside the station will not start!
server {Listen server_name 1.jb51.net; location/{Proxy_pass http://208.28.188.249:81;}}
server {Listen server_name 2.jb51.net; location/{Proxy_pass http://208.28.188.249:82;}}
}

This is the proxy server configuration, is to find a not sealed 80 IP or rent a foreign VPS can be, otherwise, you will be open to the local 80 conflict, and then through this proxy server to jump to your seal 80 of the machine, seal 80 of the machine site to add an empty host head port is 81 can be, Here 81 is casually filled in, the computer has 655,535 ports you can set up, so that seal 80 is also useless!

Brother, then write a specific fool-type operation steps:
1, the above software download to your 80 did not seal the server configuration is good, this is best not to have a website, otherwise will and your original site with 80 conflicts;
2, your domain name to resolve to the above 80 IP, and then to your seal 80 machine on the original site to add an empty host head port is 81, such as http://192.168.0.11:81 can access to your site on it;
3, Nginx.exe every time the configuration file needs to be completed within the Task manager after the task to start again before it will take effect, is immediately effective! Remember that the two Nginx.exe process will end, otherwise useless;
4, 1.jb51.net here is replaced by your domain name, a number of domain names separated by space, there is no limit, a station line, not multiple stations on one line;
5, Kai Nginx.exe directly double-click, will flash over, as long as the task manager in the process of two Nginx.exe is normal operation, otherwise the configuration file error did not start;
6, appear 504 Gateway time-out this error is your proxy server can not access http://192.168.0.11:81 this address, you can try, if you can server can not be related to your firewall or strategy;

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.