Answer the question
In order to leave comments, you need to log in
How to implement domain redirection in nginx to the IP of a virtual machine inside the network?
Good day to all.
There is a firewall through which I can only port 80 for the 1st domain.
I want to implement a domain redirect to a virtual machine via nginx
Maybe someone had such a practice, I would be very grateful for the answer. Thanks
Answer the question
In order to leave comments, you need to log in
Installed HAProxy.
Through nginx, I manually add files with site names and .conf extensions
to the /etc/nginx/sites-enabled
domen.com.conf directory
server {
listen 80;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# Add index.php to the list if you are using PHP
server_name domen.com;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://192.168.1.50/;
}
}
You need a reverse proxy mechanism. Very easy to google and set up.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question