Apache2 config giving 404 on document root with http but not https

0

I am currently tring to get my apache 2 server to work. I can connect successfully via https. But http does give a 404 error.

vhost http

<VirtualHost example.com:80>
        ServerName example.com
        ServerAlias www.example.com
        ServerAdmin webmaster@example.com

        DocumentRoot /var/www/example.com/html
        #<Directory /var/www/example.com/html>
        #        Options Indexes FollowSymLinks MultiViews
        #        AllowOverride None
        #        Order allow,deny
        #        allow from all
        #</Directory>

        <ifmodule mod_rewrite.c="">
              RewriteEngine On
              RewriteCond %{HTTPS} off
              RewriteRule (.*) https://%{HTTP_HOST}$1 [R=301,L]
        </ifmodule>

        #SSL Redirect
        Redirect permanent / https://example.com/

        ErrorLog /var/log/apache2/error.log
        LogLevel warn
        CustomLog /var/log/apache2/access.log combined
        ServerSignature On
</VirtualHost>

And my https vhost

<VirtualHost *:443>
    ServerName example.com
    ServerAlias www.example.com
    ServerAdmin webmaster@example.com

    SSLEngine on
    SSLCertificateFile      /etc/letsencrypt/live/example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

    # Pfad zu den Webinhalten
    DocumentRoot /var/www/example.com/html
</VirtualHost>

Thanks for taking a look.

school_guy

Posted 2017-03-29T22:33:31.573

Reputation: 1

Answers

-1

I removed the example.com:80 and replaced it with *:80.

school_guy

Posted 2017-03-29T22:33:31.573

Reputation: 1