[Solved] Migrating Apache 2.2 to 2.4 (Squeeze -> CentOS 7)

Issues related to applications and software problems
Post Reply
User avatar
ddeimeke
Posts: 9
Joined: 2014/07/08 06:29:54
Location: Gruet (Gossau ZH), Switzerland
Contact:

[Solved] Migrating Apache 2.2 to 2.4 (Squeeze -> CentOS 7)

Post by ddeimeke » 2015/02/27 16:09:14

Hi!

Maybe I am just to blind to see. I try to get my website "www.deimeke.net" up and running.

I have an httpd-Server in standard configuration with php enabled, additional php modules are installed and working. SELinux is set to permissive and all Files below /srv/www/deimeke.net belong to "apache:apache".

I have a website called "moas.mhochzwei.net" which redirects http to https, this is working with php.

Config file moas.mhochzwei.net.conf:

Code: Select all

<VirtualHost 94.126.23.98:80>
        ServerName moas.mhochzwei.net
        ServerAdmin dirk@deimeke.net
        RewriteEngine on
        RewriteCond %{HTTP_HOST}   !^$
        RewriteRule ^/(.*)         https://moas.mhochzwei.net/$1 [L,R]
</VirtualHost>
Config file moas.mhochzwei.net-ssl.conf:

Code: Select all

<VirtualHost 94.126.23.98:443>
    ServerName moas.mhochzwei.net
    ServerAdmin dirk.deimeke@myown-it.com
    DocumentRoot /var/www/html

    <Directory /var/www/.git>
        Order deny,allow
        Require all denied
    </Directory>

    ErrorLog /var/log/httpd/moas.mhochzwei.net/error.log
    CustomLog /var/log/httpd/moas.mhochzwei.net/access.log combined

    RewriteEngine On

    SSLEngine On
    SSLProtocol all -SSLv2 -SSLv3
    SSLCertificateFile /etc/pki/tls/private/2015/moas.mhochzwei.net.crt
    SSLCertificateKeyFile /etc/pki/tls/private/2015/moas.mhochzwei.net.key

    SSLCertificateChainFile /etc/pki/tls/private/2015/sub.class2.server.ca.pem

    <Directory /var/www/html/phpMyAdmin>
        AuthType Basic
        AuthName "- phpmyadmin -"
        AuthUserFile /srv/pwd/phpmyadmin.htpasswd
        Require valid-user
        AllowOverride All
    </Directory>

    <Directory /var/www/html/oc>
        AllowOverride All
    </Directory>

</VirtualHost>
And this is the configuration for http://www.deimeke.net (deimeke.net.conf):

Code: Select all

<VirtualHost 94.126.23.98:80>

    ServerName www.deimeke.net
    DocumentRoot /srv/www/deimeke.net

    <Directory /srv/www/deimeke.net/.git>
        Order deny,allow
        Require all denied
    </Directory>

    ErrorLog /var/log/httpd/deimeke.net/error.log
    CustomLog /var/log/httpd/deimeke.net/access.log combined

    <Directory /srv/www/deimeke.net>
        Require all granted
        Options Indexes
        AllowOverride all
    </Directory>

</VirtualHost>
Calling http://www.deimeke.net/ leads to the default page of http://moas.mhochzwei.net - for http://www.deimeke.net/dirk/blog/ I get a 403 Forbidden.

How do I get this up and running?

Any hint is highly appreciated.

Thanks a lot

Dirk
Last edited by ddeimeke on 2015/02/28 15:51:57, edited 2 times in total.

User avatar
WhatsHisName
Posts: 1549
Joined: 2005/12/19 20:21:43
Location: /earth/usa/nj

Re: Migrating Apache 2.2 to 2.4 (Squeeze -> CentOS 7)

Post by WhatsHisName » 2015/02/27 16:39:21

Is there a question that I missed. :-)

Just looked at httpd 2.4 the other day for the first time (nothing in production yet) and this one jumped out at me:

"The Allow, Deny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use."

I suspect the "Require all denied" is causing you problems. You probably meant "Require all granted", unless you really wanted to deny access.

It is worth reading up on the Require Directive and the other conditional directives (e.g., <RequireAny>).

User avatar
ddeimeke
Posts: 9
Joined: 2014/07/08 06:29:54
Location: Gruet (Gossau ZH), Switzerland
Contact:

Re: Migrating Apache 2.2 to 2.4 (Squeeze -> CentOS 7)

Post by ddeimeke » 2015/02/28 08:56:11

WhatsHisName wrote:I suspect the "Require all denied" is causing you problems. You probably meant "Require all granted", unless you really wanted to deny access.

It is worth reading up on the Require Directive and the other conditional directives (e.g., <RequireAny>).
For the named directory ".git" I don't want users to access it, but the other directories should be accessible by users. Maybe you saw that there is a "require all granted" for "Directory /srv/www/deimeke.net".

Any other ideas?

Cheers

Dirk

User avatar
ddeimeke
Posts: 9
Joined: 2014/07/08 06:29:54
Location: Gruet (Gossau ZH), Switzerland
Contact:

Re: Migrating Apache 2.2 to 2.4 (Squeeze -> CentOS 7)

Post by ddeimeke » 2015/02/28 13:22:15

Solved:

There is an error in the official Upgrading to 2.4 from 2.2.

It says
2.2 configuration:
Order allow,deny
Allow from all

2.4 configuration:
Require all granted
But it should be
2.4 configuration:
Require all granted
Order allow,deny
Allow from all
Cheers

Dirk

Post Reply