Solved DocumentRoot on apache

What directory do people use on apache for DocumentRoot?

I'm think about various applications such as Wordpress.

Some examples I've seen use /usr/local/www/wordpress others use /usr/local/www/apache24/data/wordpress.

I realise both will work, but wondered which most people used.
 
Don't use /usr/local/www/apache24/data, that's all I can say. It's where Apache's default "It works" website lives, leave that as-is. Same for /usr/local/www/nginx/ with nginx.

I like /usr/local/www/<mywebsite>/, for example /usr/local/www/example.com/, keeps everything nice and separated. It's also independent of the web server being used.
 
In like to put it in /var/www/<website>/ because to me it makes sense to put the data in /var/ as my mail and printer files also live there.
 
In like to put it in /var/www/<website>/ because to me it makes sense to put the data in /var/ as my mail and printer files also live there.
I think, in /var is the classical place.

/usr/local is a FreeBSD custom, because one wants to separate base system from installed packages.

But if you have a small root and not a big system mounted on /var, then is not appropriate.

What directory do people use on apache for DocumentRoot?

Is there a reason you are using apache? See my other thread.
 
I had websites in /srv/www on openSUSE (iirc ftp defaults there too); I like /srv more than /var for serving content
Makes sense but /srv/ is not in hier(7) and I dislike adding more top-level directories. Further more, /var/www/ is shorter than /usr/local/www/ and hier(7) mentions /usr/local/ is for programs installed by pkg(7) and ports(7) which does not include website data in my opinion.
 
Despite the fact that I no longer work with Solaris I still very much prefer using /opt whenever it suits the situation. A local Minecraft server? /opt/minecraft, my jails? /opt/jails and you can probably guess where this is going? ;) I also utilize /opt/www for all my own personal sites while still keeping /usr/local/www around for "defaultish" contents.
 
I think under /home/www would be the right place. Web-Content deserve backup like the data of users.

If you make it a login user, you can directly login to work in it or send files with scp file www@server:place.

Perhaps I implement this idea ...
 
I have been using the default /usr/local/www/ (how do you make the paths green?) for so long now, that my brain is almost like a ROM, and since I moved over to ZFS, it's going to be REALLY difficult to "re-learn" allt the new paths.
 
how do you make the paths green?
 
Don't use /usr/local/www/apache24/data, that's all I can say. It's where Apache's default "It works" website lives, leave that as-is. Same for /usr/local/www/nginx/ with nginx.

I like /usr/local/www/<mywebsite>/, for example /usr/local/www/example.com/, keeps everything nice and separated. It's also independent of the web server being used.
To make such a change is it best to add something like this to /usr/local/etc/apache24/includes rather that the main conf file?

Code:
DocumentRoot "/usr/local/www/$website"
<Directory "/usr/local/www/$website">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
 
I'm getting

Forbidden​

You don't have permission to access this resource.

When I try to access ***.***.***.***/

Does this URL specify DocumentRoot? www is the owner and I have Require all granted set.

What am I missing?
 
something like this to /usr/local/etc/apache24/includes rather that the main conf file?
Basic virtual host stanza, you put this in /usr/local/etc/apache24/Includes/:
001_mywebsite.conf:
Code:
<VirtualHost *:80>
  ServerName mywebsite.example.com

  DocumentRoot /usr/local/www/mywebsite

  <Directory /usr/local/www/mywebsite>
     Require all granted
  </Directory>

</VirtualHost>
 
Back
Top