By V1ncam
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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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 on blog, your Nginx config would look something like this:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name blog.example.com;
client_max_body_size 10G;
location / {
proxy_pass http://localhost:2368;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
}
}
server {
listen 80;
listen [::]:80 ipv6only=on;
root /var/www/html/;
index index.html index.htm;
server_name www.example.com;
location / {
try_files $uri $uri/ =404;
}
}
This would serve static html from the directory /var/www/html/ at www.example.com It would also proxy a Ghost instance running on port 2368 to blog.example.com The server_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:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.