Saeed
Saeed

Reputation: 4125

Apache only showing contents of /var/www/html but no any other websites (error 403)

I have installed PHP+Apache in my Docker Ubuntu container, but I have a problem:

When I define no website in /etc/apache2/sites-available and I access my site docker2.mysite.com/info.php, I see the contents of .php file being executed well, but when I add a docker2.conf in that path and run a2ensite site then reloading apache, I get error 403.

It seems the issue is the files in /var/www/html/ are executed, while other sites are not running.

Here is docker2.conf contents:

<VirtualHost *:80>
        ServerName docker2.mysite.com

        ServerAdmin webmaster@docker2
        DocumentRoot /home/docker2
        <Directory />
        DirectoryIndex index.html
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

I have tried chowning DocumentRoot to www-data but it does not change.

A couple of days ago I have done this and the site was executing from its own path, but I don't know what's the issue it's not working.

Upvotes: 0

Views: 711

Answers (1)

on8tom
on8tom

Reputation: 1894

by default your apache acl denies from all for your hole system, and allowes form /var/www/html

add an allow from all or a require all granted depending on your version.

        <Directory /home/docker2>
            DirectoryIndex index.html
            Require all Granted
        </Directory>

Upvotes: 1

Related Questions