Page 1 of 1

Virtual Hosts in NGINX vs Apache

Posted: 2017/11/08 10:43:27
by mcheoti
Hi everyone!

I want to add more than one virtual host on my server. On Apache it is an easy task,
Edit the httpd.conf and add 2 entries, restart the server and done.

Code: Select all

<VirtualHost *:80>
ServerName server1.mydomain.com
    DocumentRoot /var/www/html/cms1
</VirtualHost>

<VirtualHost *:80>
ServerName server2.mydomain.com
     DocumentRoot /var/www/html/cms2
</VirtualHost>
But how can i do that in NGINX ? I mean setting up, things like this Link:
https://www.digitalocean.com/community/ ... n-centos-7
is a little bid strange for me. is there an easier way ?

I mean the next step in my config would be to forward the request to another internal IP Adress.
In the ssl.conf it was possible via

Code: Select all

<IfModule mod_proxy.c>
....
       ProxyPass /ui/ http://192.168.8.1:8080/ui/ timeout=360
       ProxyPassReverse /ui/ http://192.168.8.1:8080/ui/
...
</IfModule>
Do you have an idea ?
Cheers Ch