How to configure Apache for SSL to work with existing Wordpress installation on Ubuntu 16.04

Hello,

I am trying to configure apache correctly so that my existing Wordpress installation can work with SSL.

I’ve got the certbot process complete. The SSL certificates are installed successfully.

Where I’m stuck: I’ve tried going through multiple guides, and have messed up my /etc/apache2/sites-available configuration files (virtual hosts files). I’m not sure whether to modify the existing “000-default.conf” and “default-ssl.conf” files, or to create my own specific files for my site. What option is recommended?

A related question thread (https://community.online.net/t/how-to-configure-wordpress-image-with-lets-encrypt/2447) mentions this guide (http://www.servermom.org/nginx-lets-encrypt-ssl-http2-ubuntu-15-10/3378/) but it’s specific to nginx, not apache.

Does anyone have an equivalent guide for Apache? Start to finish? I’ve looked at multiple guides, and none seem to cover everything, or are not specific to my configuration.

My web server is (include version): Apache/2.4.18 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 16.04.01 LTS

My hosting provider, if applicable, is: Scaleway

I can login to a root shell on my machine (yes or no, or I don’t know): Yes

I’m using a control panel to manage my site: No

Please let me know if I should provide log files or detail more steps.

Thanks in advance.

Hi @dfgolh90,

Did you use certbot --apache or some other form like certbot certonly --webroot?

Hi schoen, thanks for your response.

I originally ran the certbot --apache command, using the Apache/Ubuntu 16.04 guide from the certbot website. If there’s a log file or other information I could provide to troubleshoot, please let me know.

Thanks!

I guess I’m confused about what the problem is. You said you used --apache and that the certificates are installed correctly. Normally that means that the site works fine in HTTPS. But yours doesn’t somehow?

I got the message that the installation process worked correctly after running certbot yes.

However, when I browse the site now:

  1. The site works (displays pages), but it’s using http instead of https (I selected the installation option to use https always when running the certbot command).

  2. When I try to login to the wordpress dashboard “mysite.com/wp-admin”, it redirects me to the https version of the page, and says it cannot connect. This means I cannot login and change anything as a wordpress admin.

  3. Running the SSL labs test gives me the message “failed to connect to the server” also.

I think I’ve made a mistake somewhere in the apache configuration (as none of the guides I’ve come across covered Ubuntu 16.04+Apache configuration), I’d love to have an Apache version of this guide to fix it, or to see a sample configuration files for apache.

The closest guide I’ve come across is for Ubuntu 14. However, in step three of this guide, it talks about creating demo index.html pages, which is not what I need for an already running Wordpress installation.

Hopefully that makes sense, thanks again.

Yes, that does make sense — thanks for the further explanation.

Do you think you could post your existing Apache configuration files so we could see what WordPress and Certbot have done with them?

Sure, it’s more a question of what I’ve done with them :wink: The guides I’ve followed are not clear.

This is my “000-default.conf” file: https://pastebin.com/JBM0rGE4

This is my “mysite.com.conf” file (unsure if it’s needed/recommended): https://pastebin.com/hu3nz9cG

This is my “default-ssl.conf” file: https://pastebin.com/G1WyuLdZ

This is my “mysite-ssl.conf” file (again, not sure if needed): https://pastebin.com/RzaAGR6x

Thanks again for your help.

man, how lucky am I to be having the same issue 4h from the last two replies… please do keep posting till resolved as this is the closest to the issue I am having I’ve found with no other successful resolution potential.

Is there any further detail that I can use or provide to troubleshoot the problem?

Thanks.

Could you tell us the real domain name?

Ok, it’s buynhodl [dot] [com]. Thanks.

Thanks!

So, is there any possibility that you have a firewall setting either on the web server itself or in a cloud hosting provider firewall configuration that simply blocks all connections on port 443? In that case your Apache configuration could be perfectly correct (or even just slightly wrong), and connections would get dropped by the firewall regardless.

Hey, I tried following some guides regarding firewall settings, but I managed to screw up the site even further sadly. Also, I don’t have a plain vanilla Wordpress installation, I installed it via Docker so some of the troubleshooting guides don’t apply in my case. I decided that I’m going down so many blind alleys that a different approach was needed.

My workaround was to find a web cache of my pages, and to simply recreate them from scratch by hand. I use a host that has a one click install for Let’s Encrypt, and it works flawlessly with Wordpress also.

It’s unfortunate that I couldn’t manage to figure out the problem, but my site was offline for quite some time and losing SEO reputation, so I decided to go with a different approach.

Thanks for all your patient advice, you deserve a lot of credit. I’m really glad to be able to be able to continue to use your wonderful product via another method.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.