By gruvemiami
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>
ServerAdmin asdf@gmail.com
ServerName asdf.com
ServerAlias www.asdf.com
DocumentRoot /var/www/asdf.com/public_html
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =asdf.com [OR]
RewriteCond %{SERVER_NAME} =www.asdf.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
Let me know if you would like me to post anything else for you guys to help me figure this headache out.
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!
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. http://imgur.com/a/aA8TE
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.