Ok so I have only one vps bought at OVH and I'd like to get my 2 websites on it. how can I do that ? Just so simple ! Get the power of apache virtual hosts with proxy service.
Note that I have also bought 2 domains name : fmjconsulting.fr and fredericmariejoseph.info.
So first things firts, log into your VPS as 'root' user. Then, add a vhost.conf file under the /etc/httpd/conf.d/
directory. In that file add the following content :
[root@ghost ~]# cat /etc/httpd/conf.d/vhosts.conf
<VirtualHost fmjconsulting.fr:80>
DocumentRoot "/var/www/fmjconsulting"
ServerName www.fmjconsulting.fr
</VirtualHost>
<VirtualHost www.fmjconsulting.fr:80>
DocumentRoot "/var/www/fmjconsulting"
ServerName www.fmjconsulting.fr
</VirtualHost>
<VirtualHost fredericmariejoseph.info:80>
DocumentRoot "/var/www/fmj.info"
ServerName www.fredericmariejoseph.info
ProxyPass / http://www.fredericmariejoseph.info:<nodejs_listening_port>/
ProxyPassReverse / http://www.fredericmariejoseph.info:<nodejs_listening_port>
</VirtualHost>
<VirtualHost www.fredericmariejoseph.info:80>
DocumentRoot "/var/www/fmj.info"
ServerName www.fredericmariejoseph.info
ProxyPass / http://www.fredericmariejoseph.info:<nodejs_listening_port>/
ProxyPassReverse / http://www.fredericmariejoseph.info:<nodejs_listening_port>
</VirtualHost>
Notice each time my 2 entries : one for my "official" domaine name and another one for the redirection to the subdomain (www.<mydomain.name>) directly programmed on the OVH DNS service manager.
Get a look also on the /
at the end of the ProxyPass url.
Then restart your httpd service :
systemctl restart httpd
That's it !