D
D
Di ExTreMe2016-02-23 18:31:46
Nginx
Di ExTreMe, 2016-02-23 18:31:46

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

2 answer(s)
D
Di ExTreMe, 2016-03-28
@ExTreMeUA

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/; 
}

}

service nginx restart
and here it is happiness :-)

C
Cool Admin, 2016-02-23
@ifaustrue

You need a reverse proxy mechanism. Very easy to google and set up.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question