Solved Correct location of Apache24 apps

What is the preferred locations of apps running under Apache24?

I have some under /usr/local/www and some under /usr/local/www/apache24/data.

I'd prefer to have everything in the same (correct) location.
 
What is the preferred locations of apps running under Apache24?

I have some under /usr/local/www and some under /usr/local/www/apache24/data.

I'd prefer to have everything in the same (correct) location.

The answer lies in your question, the preferred location is a matter of preference, and I go as far stating that there is not such a thing like a correct preference. Some preferences maybe more reasonable than others, however, also this depends on the perspective.

I prefer to keep the default webroot of Apache 2.4 at /usr/local/www/apache24/data/, and in there I got sub-directories for the different domains. I got other specialized web services provided by non Apache daemons, and the webroot of these is at /usr/local/www/MYSERVICE/. I think, that in my case this keeps the things a little bit better separated. If you never pretend to run or experiment with any other web server, then the suggestion of segfault0 isn't that bad either.
 
Applications that are not installed into/usr/local/www/apache24/data need an Alias or VirtualHost (+ appropriate DocumentRoot) to become accessible throught HTTP/Apache.

IMO, I found preferable to not directely install those apps in default's Apache DocumentRoot in order to let you configure how to access them and not to be accessible until you are ready for it.
 
In my opinion it's better not to install these in the Apache default webroot but to keep them in a specific default location (such as /usr/local/www) after which you'll have to add them to your web configuration yourself. Usually that's done by adding both an Alias as well as a <Directory> directive. For example, this is what I used for Bugzilla:

Code:
        Alias /bugtrack /usr/local/www/bugzilla
        #
        <Directory /usr/local/www/bugzilla>
                AddHandler cgi-script .cgi
                Options ExecCGI FollowSymLinks
                DirectoryIndex index.cgi
                Order allow,deny
                Allow from all
        </Directory>
Reasoning should be simple: security. Because this way I can always limit access to the application in order to ensure that no 3rd parties could accidentally stumble into an installation screen (which could create some serious issues).

I'd even suggest not using the default Apache webroot either but instead set something up yourself. For example, most of my production websites live somewhere in /opt, which includes the limited SUEXEC docroot. The thing is: if you use default locations then it could be a lot easier for a possible attacker to exploit those. He probably already has the file location right. But using something completely different makes this a lot more difficult.
 
Code:
        Alias /bugtrack /usr/local/www/bugzilla
        #
        <Directory /usr/local/www/bugzilla>
                AddHandler cgi-script .cgi
                Options ExecCGI FollowSymLinks
                DirectoryIndex index.cgi
                Order allow,deny
                Allow from all
        </Directory>

For www/apache24 the syntax would be:
Code:
        Alias /bugtrack /usr/local/www/bugzilla
        #
        <Directory /usr/local/www/bugzilla>
                AddHandler cgi-script .cgi
                Options ExecCGI FollowSymLinks
                DirectoryIndex index.cgi
                Require all granted
        </Directory>

I have been using apache for many years and I must admit that the performance in version 2.4 is really way better. However, they had to change some bits and pieces in the syntax which makes the upgrade path of complicated virtual hosts a real pain!
 
I have just installed Drupal8 which FreeBSD has put in /usr/local/www/drupal8.

http://localhost/drupal8/core/install.php is Not Found .

If I move the installation to /usr/local/www/apache24/data it works.

I tried adding a <Directory> directive to httpd.confbut can't get it to work.

Just in case I have the same problem in future, I'll note that I got the options to the <Directory> directive wrong, and that I need to follow examples for Apache 2.4.
 
Back
Top