How do I setup yourls URL re-director to use only HTTPS

1.8k Views Asked by At

I have successfully installed yourls, but I want to make the site https only. How do I do that? I am running it successfully on Ubuntu 16.04, but I want to make it all HTTPS in the setup. Unfortunately, the yourls site doesn't explain how to do this at all.

I have configured apache2...

1.a2enmod ssl

2.service apache2 restart

3.mkdir /etc/apache2/ssl openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

I changed the default :80 site to redirect to 443.

<VirtualHost 192.168.0.100:80>
    ServerName  example.com/
    Redirect / https://example.com/
</VirtualHost>

I have changed the default-ssl to include

<VirtualHost *:443>

        ServerAdmin [email protected]


        ServerAlias example.com
        ServerAlias example.com

        DocumentRoot "/var/www/html"
                <Directory "/var/www/html/">
                        Require all granted
                        Options FollowSymLinks
                        AllowOverride All
                        Order allow,deny
                        Allow from all
                </Directory>


        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key

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

</VirtualHost>

and changed the url site home in /user/config.php to https://example.com

but yourls will not load. It redirects to https fine. but no site.

Has anyone setup this up before? Thanks in advance for any guidance.

1

There are 1 best solutions below

0
AudioBubble On

setup apache cert for https.

change the base uel to https in user config

on the admin page, install plugin to provide ssl to ssl.

any https links will be https short coded. any links made before need to be re-created if you want them to be https redirected.