1

I have compiled apache 2.4 to ubuntu linux desktop and configured DocumentRoot directive to point to /usr/local/apache2/htdocs. Instead of serving index.html in configured DocumentRoot, apache keeps looking into /var/www. Am I missing some configuration

It seems that apache server actual index page from ?/var/www when i use alias localhost as url, and when using 127.0.0.1 it serves directory index from documentroot directory

Target is to configure apache to serve directory index from DocumentRoot under localhost url

Actual configuration:

DocumentRoot "/usr/local/apache2/htdocs"

< Directory "/usr/local/apache2/htdocs">

Options +Indexes

AllowOverride None

Require all granted

< /Directory>

  • I have the same problem, and I swear, I've solved it before, but it's been so long since I used apache that I can't remember what the fix was :/ – siliconrockstar Jun 6 '17 at 1:40
1

You need a ServerName directive to use name based virtual hosts.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /usr/local/apache2/htdocs
ServerName localhost

<Directory /usr/local/apache2/htdocs>
    AllowOverride All
    Options -Indexes +FollowSymLinks
    Require all granted

    # turn Magento developer mode on
    # SetEnv MAGE_IS_DEVELOPER_MODE 1;

</Directory>

Make sure localhost resolves to 127.0.0.1 Make sure that there is an index.html file in your web root

Restart apache

apache2 restart

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.