Answer the question
In order to leave comments, you need to log in
How to set up a proxy webserver and bind subdomains for services running in a virtual machine?
Confused about the configuration.
There is a host on which bind, apache and KVM virtual machines.
The virtual machine runs several services both on ports 80/443 and on non-standard ones.
There is a main domain (domain.ru), and services to which you also need to add subdomains (service1.domain.ru, service2.domain.ru).
As I did now:
On the host, in each zone, bind added the required number of A-records like
domain.ru. IN A XX.XX.XX.XX
service1 IN A XX.XX.XX.XX
service2 IN A XX.XX.XX.XX
<VirtualHost *:80>
ServerName domain.ru
ServerAlias service1.domain.ru service2.domain.ru
ServerAdmin [email protected]
DocumentRoot /var/www/html/
ProxyRequests Off
ProxyPass / http://192.168.202.2
ProxyPassReverse / http://192.168.202.2
<Location />
Require all granted
</Location>
ErrorLog ${APACHE_LOG_DIR}/domain.ru_error.log
CustomLog ${APACHE_LOG_DIR}/domain.ru_access.log combined
LogLevel error
</VirtualHost>
server {
listen 80;
listen [::]:80;
server_name domain.ru www.domain.ru 192.168.202.2;
root /srv/www/domain.ru/html;
access_log /srv/www/domain.ru/logs/domain.ru.access;
error_log /srv/www/domain.ru/logs/domain.ru.error error;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
root /srv/service1/build;
server_name service1.domain.ru;
index index.html index.htm;
location / {
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question