Welcome! Log In Create A New Profile

Advanced

Nginx proxying Apache multiple domain to multiple IP's

Posted by marvine 
Nginx proxying Apache multiple domain to multiple IP's
November 04, 2009 11:17PM
I have 3 IP's on my server 80.90.100.1, 80.90.10.2, 80.90.100.3 and 3 domains
domain1.com, domain2.com, domain3.com
I want nginx proxying apache each domain to different IP.

Currently I point 3 domains to one IP and everything work fine.
What changes I have to do in these config files
Thank you.

ngnix.conf
_____________________________________________________________________________________________
user www-data;
worker_processes 4;
error_log /etc/nginx/logs/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server {
listen 80;
server_name _;
server_name_in_redirect off;
access_log /etc/nginx/logs/access.log main;
location / {
proxy_pass http://80.90.100.1:8080/;
root /varr/sites/site~*;
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;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 10m;

}
}
}

apache port.conf
_____________________________________________________________________________________________
NameVirtualHost 80.90.100.1:8080
NameVirtualHost 80.90.100.2:8080
NameVirtualHost 80.90.100.3:8080
Listen 8080

apache mod_rpaf.conf
_____________________________________________________________________________________________
<IfModule mod_rpaf.c>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 80.90.100.1:8080 80.90.100.2:8080 80.90.100.3:8080
</IfModule>

apache virtualhosts.conf
_____________________________________________________________________________________________
<VirtualHost 80.90.100.1:8080>
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/sites/site1
ErrorDocument 404 /index.html
ErrorDocument 403 /index.html
ScriptAlias /cgi-bin/ /var/sites/site1/cgi-bin/
<Directory /var/sites/site1>
AllowOverride All
Options -Indexes
</Directory>
</VirtualHost>

<VirtualHost 80.90.100.1:8080>
ServerName domain2.com
ServerAlias www.domain2com
DocumentRoot /var/sites/site2
ErrorDocument 404 /index.html
ErrorDocument 403 /index.html
ScriptAlias /cgi-bin/ /var/sites/site2/cgi-bin/
<Directory /var/sites/site2>
AllowOverride All
Options -Indexes
</Directory>

</VirtualHost>

<VirtualHost 80.90.100.1:8080>
ServerName domain3.com
ServerAlias www.domain3.com
DocumentRoot /var/sites/site3
ErrorDocument 404 /index.html
ErrorDocument 403 /index.html
ScriptAlias /cgi-bin/ /var/sites/site3/cgi-bin/
<Directory /var/sites/site3>
AllowOverride All
Options -Indexes
</Directory>

</VirtualHost>
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 108
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready