HTTPS redirect not working

Ok, move the nextcloud.conf from sites_available to conf.d and rename the ssl_conf to ssl.conf and try restarting your apache again.

just do it…but same error on start

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2020-01-17 13:47:12 CET; 9s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 12238 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 12236 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 12236 (code=exited, status=1/FAILURE)

Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: Starting The Apache HTTP Server...
Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 17 13:47:12 test-nextcloud.xxx.xxx kill[12238]: kill: cannot find process ""
Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: Failed to start The Apache HTTP Server.
Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: Unit httpd.service entered failed state.
Jan 17 13:47:12 test-nextcloud.xxx.xxx systemd[1]: httpd.service failed.

Hi Emiliano,

what happens if you enter apachectl configtest? Do you get a Syntax OK, or does it say something else?

i get the Syntax Ok message but the url is not unreachable

Syntax OK is a good sign!

Just a small recap:

  1. You have a nextcloud.conf and a ssl.conf in /etc/httpd/conf.d/?
  2. The content of these is as follows:

nextcloud.conf

<VirtualHost _default_:80>

        ServerName test-nextcloud
        Redirect / https://xx.xx.xxx.xxx/

</VirtualHost>

ssl.conf

<VirtualHost _default_:443>

        ServerAdmin  test-admin
        ServerName test-nextcloud
        DocumentRoot /var/www/html/nextcloud

        SSLEngine on
        SSLCertificateFile /etc/pki/tls/certs/ca.crt
        SSLCertificateKeyFile /etc/pki/tls/private/ca.key

        SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
        SSLCipherSuite HIGH:!MEDIUM:!aNULL:!MD5:!RC4
        SSLUseStapling on
        SSLHonorCipherOrder off

        <Directory /var/www/html/nextcloud>

                Options +FollowSymLinks
                AllowOverride All
                Require all granted

        </Directory>

        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud

        TransferLog /var/log/httpd/nextcloud_access.log
        ErrorLog /var/log/httpd/nextcloud_error.log

</VirtualHost>

nextcloud.conf is in sites-available …i hav tried to put into conf.d but the same error was displayed

But looking at the httpd.conf you posted in one of your earlier posts, the folder sites-available is not being loaded upon starting the httpd.service, so the nextcloud.conf will never be loaded?

i don’t know…i have to check this… httpd conf need a string to load nextcloud.conf?

No, since your httpd.conf has the following at the end

# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.

IncludeOptional conf.d/*.conf

It is loading all the config files in that directory. So all *.conf files should be put into that directory.

with the netxclouf file in conf.d and the ssl.conf compiled the sercive httpd doesn’t start…but the syntax is ok

now it works…with my ssl.conf and the nextcloud.conf into conf.d

Thanks!!

Glad to hear that it works now, just out of curiosity, did you change anything else apart from moving the nextcloud.conf and ssl.conf into the conf.d directory?

Maybe this might help someone else in the future.

no other change…but ssl was the original

now i get an error when i try to enable EHTTP Strict Transport Security.
i put these strings into nextcloud.conf

<VirtualHost *:443>
 ServerName test-nextcloud
   <IfModule mod_headers.c>
     Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
   </IfModule>
</VirtualHost>

You are putting the SSL configuration in the non-ssl conf again. Remove the above from the nextcloud.conf again and add the Header to the ssl.conf

resolved…

now i have to fix this
Your web server is not properly set up to resolve "/.well-known/caldav
Your web server is not properly set up to resolve "/.well-known/carddav

resolved :slight_smile: