Question

Change root directory for a domain?

Posted April 8, 2014 4.9k views
I have a development directory (/build) and a public directory (/public) how do I serve the public directory as the home? I don't want to have to do a re-direct or obviously serve the site on http://www.mysite.io/site/public Any thoughts I can't find anything? P.S I am not using any stack, I don't think I need apache (even though I think it's installed already) or php. This is a node.js app and I think I may eventually run this on port 3000, and eventually need to figure out how to serve that on port 80 instead.

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.

×
2 answers
Hi Michael,

There are a number of ways that you can accomplish this. I'd suggest serving your site with Nginx. This article should set you on the right path:

https://www.digitalocean.com/community/articles/how-to-host-multiple-node-js-applications-on-a-single-vps-with-nginx-forever-and-crontab

If the node.js app is going to run on port 3000, your Nginx configuration could be as simple as:

server {
listen 80;

server_name your-domain.com;

location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
by Christian Fei
This is our tutorial on hosting multiple Node.js apps on a single VPS with nginx, forever, and crontab.
Ah nice, I was just reading into that I came across this https://www.digitalocean.com/community/articles/how-to-install-laravel-with-nginx-on-an-ubuntu-12-04-lts-vps and I figured I probably need to be running on apache or nginx.

Thanks!
by Wouter ten Bosch
Here's how to install Laravel with Nginx on an Ubuntu 12.04 LTS VPS.
Submit an Answer