"/var/www/html/" or "/srv/" ?

Issues related to configuring your network
Post Reply
hack3rcon
Posts: 757
Joined: 2014/11/24 11:04:37

"/var/www/html/" or "/srv/" ?

Post by hack3rcon » 2019/06/25 10:54:12

Hello
Which directory used for web server? "/var/www/html/" or "/srv/" ?

Thanks.

Thraex
Posts: 51
Joined: 2019/05/14 19:50:28

Re: "/var/www/html/" or "/srv/" ?

Post by Thraex » 2019/06/25 12:20:03

Either one should work the same. The default is /var/www/html so it shouldn't need too much to work but if you want to use /srv/, just make sure your SELinux contexts are correct and httpd knows that's where to look

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: "/var/www/html/" or "/srv/" ?

Post by MartinR » 2019/06/25 14:10:02

See https://refspecs.linuxfoundation.org/FH ... hs-3.0.pdf, page 16 section 3.17. /srv : Data for services provided by this system. What I've done in the past is to expose services by linking to the specific directory, for instance /srv/www -> /var/www or /srv/wiki -> /Dokuwiki. The advantage of doing this is that you can move applications according to cluster or space demands whilst retaining a published entry.

mctesy
Posts: 5
Joined: 2019/07/01 13:31:14

Re: "/var/www/html/" or "/srv/" ?

Post by mctesy » 2019/07/01 13:41:59

It's always a good practice to use the "/var/www/html" for webpages over other directory because it's already been setup for webpages purpose, if you use srv it's a different purpose. The advantage of using "/var/www/html" is the security hierarchy anything inside the /html only belong to that folder. But if you use other directory you need to do more setup adjustment on the initial setup, it can be done but it will take some time and digging of the files. Hope that helps a bit.

Post Reply