Question

Change root directory for a domain?

  • Posted April 8, 2014

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.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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. <br> <br>Thanks!

Hi Michael, <br> <br>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: <br> <br>https://www.digitalocean.com/community/articles/how-to-host-multiple-node-js-applications-on-a-single-vps-with-nginx-forever-and-crontab <br> <br>If the node.js app is going to run on port 3000, your Nginx configuration could be as simple as: <br> <br>server { <br> listen 80; <br> <br> server_name your-domain.com; <br> <br> location / { <br> proxy_pass http://localhost:3000; <br> proxy_http_version 1.1; <br> proxy_set_header Upgrade $http_upgrade; <br> proxy_set_header Connection ‘upgrade’; <br> proxy_set_header Host $host; <br> proxy_cache_bypass $http_upgrade; <br> } <br>}