LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where to store website files? (https://www.linuxquestions.org/questions/linux-newbie-8/where-to-store-website-files-4175467087/)

NotionCommotion 06-23-2013 11:39 AM

Where to store website files?
 
Hi,

I have a CentOS 6.4 VPS which runs several Apache virtual web servers.

My VPS provider set each one in /home (for instance, /home/website1/html was the root for website1, /home/website2/html was the root for website2, etc.

While this works, it is a little strange as website1, website2, etc are not normal users.

I am wondering if it is best to move them all to /var/www so that /var/www/website1/html will be the root for website1, etc. Then make Apache run as user Apache whose home directory is /var/www.

Thanks

lleb 06-23-2013 01:19 PM

it really does not matter were they ar as long as httpd.conf knows were to find them.

personally i have mine in /www on my web server no need for any higher directory other then / as far as im concerned.

/www/foo.com/doc
/www/foo2.com/doc

etc...

so having them in /home/foo.com/html is just fine as long as you have the storage space on the /home partition, if that is even a separate partition.

jpollard 06-23-2013 05:59 PM

Quote:

Originally Posted by lleb (Post 4977154)
it really does not matter were they ar as long as httpd.conf knows were to find them.

personally i have mine in /www on my web server no need for any higher directory other then / as far as im concerned.

/www/foo.com/doc
/www/foo2.com/doc

etc...

so having them in /home/foo.com/html is just fine as long as you have the storage space on the /home partition, if that is even a separate partition.

AND remember to tell SELinux where they are, and set the appropriate security labels.

The reason to tell SELinux where they are is so that if a relabel event occurs (usually during updates) it will know what the proper label is for these files.

Without the appropriate security labels, apache will be blocked from access.

Other than that, it should work just fine.

NotionCommotion 06-23-2013 08:35 PM

Thanks all,

I think I will put them in /var/www just because that is what CentOS does. Don't know if necessary, but maybe SELinux will magically be set up (on my list of things to learn, but currently don't understand exactly how it does what it does).

lleb 06-23-2013 11:22 PM

great point jpollard.

John VV 06-24-2013 03:13 PM

The standard location on RHEL/CentOS/SL is /var/www/html
the CMS is normally in "/var/www/html "

but it really can be almost any place , however SE might NOT like a folder directly on "/" ( like "/http" )

/home/www ( with www as a user and IS owned BY "apache" and in the "apache" user group )
a bit odd but usable as long as SE and the /etc/httpd.conf knows about that

My preferences are a bit "non-standard" .I like to have everything all together ( a bit easier to manage and lock down )
/var/www/Apache
/var/www/MySQL
/var/www/MySQLAdmin
/var/www/phpmyadmin
/var/www/AwStats
/var/www/TheCMS.Software

but this is just my likes ,
do some research and make up your own mind


All times are GMT -5. The time now is 11:42 PM.