Answer the question
In order to leave comments, you need to log in
Is it possible to redirect packets so that 2 sites open?
Good afternoon.
There is a mx.example.com domain, which corresponds to an external ip 152.56.89.52, when opening the domain, we get to the web version of the exchange mailbox (internal IP 192.168.5.2). https://mx.example.com/owa.
There is another server under ubuntu 14.04 with apache2 installed (internal IP 192.168.5.3).
I wrote in apache2.conf:
<VirtualHost 192.168.5.3>
ServerAdmin [email protected]
ServerName data.example.com
DocumentRoot /var/www/owncloud
ErrorLog /var/log/data.example.com-error_log
TransferLog /var/log/data.example.com-access_log
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
server {
listen 80;
server_name data.exemple.com;
if ($http_host ~ "(?i)(data\.exemple\.com)$") {
rewrite ^(.*) /web/$1 last;
}
location /web// {
proxy_pass http://data.exemple.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 500;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/conf.d/cert/mail.crt;
ssl_certificate_key /etc/nginx/conf.d/cert/mail.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
server_name mx.example.com;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
if ($http_host ~ "(?i)(mx\.example\.com)$") {
rewrite ^(.*) /web/$1 last;
}
location /web// {
proxy_pass https://mx.example.com;
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;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 500;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question