Driving home network requires that we have a good server on which the raised part of the KVM and hosting consists of two (or more) virtual ok - Router (Firewall), the router comes to a White IP. Web server (s). To each could allocate a separate Web server. Nginx put on the router and will proxate domain names of sites on the Web server is necessary to us.
Let's go, let's add nginx repository in yum, create a file nano /etc/yum.repos.d/nginx.repo and copy the following lines:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
Change $ releasever to "5" (for 5.x) or a "6" (for 6.x), depending on the version of your operating system.
Ctrl+O Ctrl+X
We put as usual:
yum install nginx
chkconfig nginx on
Open the configuration file nginx nano /etc/nginx/nginx.conf and change the worker_processes. It must be equal to the number of processors on your servere.V our case, we have given router Dev 4 cores so;
worker_processes 4;
Enable compression:
gzip on;
Ctrl+O Ctrl+X
service nginx start
The file nano /etc/sysconfig/iptables, add the line (opening port 80):
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
service iptables restart
Now, since we have a specific configuration, create a file in which nano /etc/nginx/conf.d/router.conf describe where we want to proxy incoming packets contents:
server {
listen 80;
server_name router.ru www.router.ru ; # then through a gap to rewrite all of the domain names that hang on your white IP in DNS
server_name_in_redirect off;
access_log /var/log/nginx/router_access.log;
error_log /var/log/nginx/router_error.log;
client_max_body_size 10m;
proxy_buffers 4 256k;
location ~ /\.git {
deny all;
}
location / {
proxy_pass http://xxx.xxx.xxx.xxx:80; #here ip web server on which your website is spinning
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Ctrl+O Ctrl+X
service nginx restart
Well, if the Apache Web server on the raised, then everything should work.
It is not difficult to guess if your configuration consists of hosting multiple independent Web servers, you have to create as many files like this with different
proxy_pass http://xxx.xxx.xxx.xxx:80; #here ip web server on which your website is spinning
for each Web server.
So, good luck.