Let's Encrypt issues with Ubuntu 16.04 LAMP + Wordpress one-click

I’ve been pulling my hair out this week setting up my VPS on DigitalOcean…I’ve literally destroyed and restarted my droplet a dozen times trying to go through the motions and figure out what is missing. There is something a bit off with the letsencrypt script that is packaged with DO’s LAMP+WP stack for Ubuntu 16.04. Either that or there are steps missing in the various tutorials.

What I’ve done so far: Started out using the 1-click install for LAMP+WP, where everything goes swimmingly at first. I’ve gone through this process, as well as setting my LAMP server up from the ground up multiple times. Every single time I’ve gone from configuring Ubuntu/Apache/MySQL/Php7.0 as a sudo user, settiing permissions, using SSH key access, setting up VHosts, and setup to the point of the WP-admin install process and everything is perfect there… Now, the problem surfaces every time I run the letsencrypt client. The site is live after I do the one-click WP install. Then, after running the script and following the tutorial on securing Apache with Let’s Encrypt I reach a server ID page that says unavailable on port 443. So, I changed my VHosts file from *:80 to *:443. After the change, the wordpress site is back up, but it seems to not be forcing HTTPS. I can open I’ve also tested my SSL and end up with A rating every time.

I could be missing something along the way, configuring my VirtualHost files improperly…Not really sure. I’ve gone through every tutorial on DO 10 times over to see if I’m missing something. Here is my VirtualHost file:

<VirtualHost *:443>  
    DocumentRoot /var/www/  

    <Directory /var/www/html/>  
        Options Indexes FollowSymLinks  
        AllowOverride All  
        Require all granted  

    ErrorLog ${APACHE_LOG_DIR}/error.log  
    CustomLog ${APACHE_LOG_DIR}/access.log combined  
RewriteEngine on  
RewriteCond %{SERVER_NAME} [OR]  
RewriteCond %{SERVER_NAME}  
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}   [END,QSA,R=permanent]  

Let me know if you would like me to post anything else for you guys to help me figure this headache out.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I just ran into the same issue. The problem is with this line:

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI}   [END,QSA,R=permanent]

The space between ^ and https should not be there. Rather it should be

RewriteRule ^https://%{SERVER_NAME}%{REQUEST_URI}   [END,QSA,R=permanent]

“^” denotes “starts with” so in the original rule only applies if the url starts with a space which will never happen. This seems to be a bug in the letsencrypt script that adds these lines to the virtual host files.

Can you visit the site using https?

Dont forget to change the setting of your Wordpress installation. Go to Setting > General and then change the Wordpress Address and Site Address accordingly. For reference check the picture below.