[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Default virtualhost on Debian Jessie with Apache 2.4.10



Hi, Dan.

On 30/04/15 16:34, Dan Ritter wrote:

>> Currently I have a unique site in sites-enabled which is accessed only
>> via HTTPS. Hoping to have an access error when trying to access this
>> site via HTTP, Apache sends me to the default site which is "It's
>> works!" page in /var/www/html.
>>
>> I was looking in the Apache configuration files where is configured the
>> default site but I have not found it. This was set at low level in the
>> compilation of the service?

> There's no magic going on. If you want a site to be accessible
> via https only, you have choices:
> 
> - don't Listen 80
> - set a VirtualHost servername:443 rather than servername:*
> - and you may want to set VirtualHost _default_:80 to some other
>   directory tree entirely.

Yes, I had defined the virtual host using <VirtualHost *:443>. Before
migrating Wheezy to Jessie for this host, I was using a default site
configuration as the following (which is almost the same that Apache
2.4.10 has in apache2.conf).

<Directory />
        Options FollowSymLinks
        AllowOverride None
</Directory>

<Directory /var/www>
        Options FollowSymLinks
        Order allow,deny
        # Require all granted (for Apache 2.4.10)
</Directory>

Thus, when trying to access the site via HTTP on Wheezy, access was not
possible. Just as access somewhere else undefined.

But with Apache 2.4.10 it seems that this behavior is not possible,
because it uses /var/www/html as default site despite having on
apache2.conf a similar configuration to that I used earlier with Wheezy
in the 000-default of sites-enabled.

Perhaps then the only alternative would be to use something like this?

<VirtualHost _default_:80>
        RedirectMatch 404 (.*)
</VirtualHost>

<VirtualHost _default_:443>
        RedirectMatch 404 (.*)
</VirtualHost>



Thanks for your prompt response.

Best regards,
Daniel


Reply to: