Hello,
I would like to setup a VPS with multiple applications. E.g. Gitlab and Ghost. Both of them in diferrent subdomains (blog.ex.com & git.ex.com). Also I would like to have an html page at www.ex.com.
I don’t care about apache or nginx. On Ubuntu 14.04.
What would be the easiest way to do this?
Greetings,
Vincam
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
This can be accomplished with Nginx by creating separate server block for each app/site. As a quick example, hosting a static site on
www
and a Ghost instance onblog
, your Nginx config would look something like this:This would serve static html from the directory
/var/www/html/
atwww.example.com
It would also proxy a Ghost instance running on port 2368 toblog.example.com
Theserver_name
directive is important so that Nginx knows where to direct the requests. This also assumes that you have DNS set up with A records for both subdomains pointing to this IP address.This tutorial should help point you in the right direction: