rodrigo
By:
rodrigo

var/www to home/user/public_html?

February 20, 2014 7k views
Hello, I'm newbie on VPS configuration but I learn quick. I have a doubt about the server arquitecture. I want to have my VPS as clean as possible, and in my old webhost server I could see I have two folders with the exact same info: var/www and /public_html As I understand, var/ww is a backup of /public_html which is the folder where Internet users go when they visit my website, is that correct? How can I do that on my VPS? My thoughts tell me that I can create the folder for each site on /home/user/public_html and create the FTP users with limited privileges, but what happens with the var/www folder?
4 Answers
you can always create a custom folder to point your OS to the root of your vhost.

what is your OS? Nginx or Aapche?
var/ww is a backup of /public_html
/var/www the webserver's default documentroot. Shared hosting panels use slightly different directory names and paths but you don't have to do the same.

My thoughts tell me that I can create the folder for each site on /home/user/public_html
You can do that but it's preferred to create a directory for each site in /var/www e.g. /var/www/example.com/public_html /var/www/example2.org/public_html and then storing the files in the corresponding public_html directories.

As for FTP, don't do that. Use SFTP instead: https://www.digitalocean.com/community/articles/how-to-use-filezilla-to-transfer-and-manage-files-securely-on-your-vps. It's installed by default and it much more secure.
by Pablo Carranza
This article will teach you how to use Filezilla to transfer and manage files securely on your VPS.
Kamal,

Mistakingly I put my site contents directly in /var/www and not in /var/www/example.com/public_html. Everything is working fine. I've a LAMP Wordpress running.

Do you think I should move all the files from /var/www to /var/www/example.com/public_html? If I move the files, do you think it will cause any issues for my sites?
@Farooq Yousuf: That should be fine. The only issue you might face is if you are trying to run multiple site from the droplet, but it's really only a matter of personal preference and organization. You can setup apache to serve files from anywhere. It's just keeps things organized nicely to use layouts like:

/var/www/site1.com
/var/www/site2.com
Have another answer? Share your knowledge.