I reinstalled Apache in my WordPress install without backing it up and now my site is not working

December 13, 2018 851 views
Apache DigitalOcean WordPress Ubuntu 16.04

Hello,

I was enabling http/2 and I for some stupid reason reinstalled Apache without backing up it's files.

I spent a lot of time now trying to recreate the Apache files that were automatically generated when I created this WordPress install via 1 click install, to no avail.

I am trying to figure out how to get the files I need to get this Droplet working again.

  • Right now I've got apache up and running, I've enabled AllowOverride All in apache.conf:
  • I also ran a2ensite mydomain.com as well
  • I added ServerName mydomain.com to the 000-default.conf in sites-available fire

I also downloaded apache files from other droplets that are working and tried to re-create the same feel, no luck.
Apache is not showing anything in error logs

Could you please point me where should I look and what should i do to T/S this since my site is still not loading?

Thank you

5 Answers

Thank you @jarland and @X40C for contribution!

What ended up being and issue is next error message:

Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!

Leaving that just in case someone else has the same/similar issue :)

Hey friend,

Sounds like you've been busy and making a solid effort on this. Maybe I can help you look at it differently. At this point I think let's break away from trying to make the configs match their original, and focus on the current state of it. What is currently happening that causes this to not work? Describe to me where the live result breaks from the desired result, and what that looks like from your perspective. Error messages, etc.

Focusing on the current state and moving forward from there will probably put us on the right path.

Jarland

  • Thank you so much for taking the time to take a look @jarland !

    Right now when I try to access the website I see "ErrConnectionRefused" in the.
    When i run sudo netstat -plunt | grep apache2 it shows me this:

    tcp6       0      0 :::80                   :::*                    LISTEN      30942/apache2
    

    This 30942 is red tho, not sure if that is an issue.

    Would you maybe recommend me to look at the certain place to find error logs?

    Thank you again !!

    • Thanks for that information, that leads me to a few thoughts. With the connection refused error, I'm going to propose that one of these is true:

      1. Port 80 is closed in the droplet's firewall
      2. The website redirects to a closed port
      3. You're visiting via https instead of http (or the website is redirecting you to https, as in #2)

      This command should confirm that the web server is responding within the droplet, for good measure:

      curl -I localhost

      Now to see if it's #1, run this:
      iptables -I INPUT -p tcp --dport 80 -j ACCEPT

      To see if it's #2, curl the domain. Here's an example of me doing that:

      [jarland@desktop ~]$ curl -I http://google.com
      HTTP/1.1 301 Moved Permanently
      Location: http://www.google.com/

      The key here is the 301 Moved Permanently, and the Location variable. This shows a redirect. If yours shows a redirect to https, then that's how you're going from a working web server to connection refused, because SSL hasn't been configured yet. In such a case, the answer is here: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

      If it's #3, then it's just a matter of changing what you're doing in the URL bar of your browser. I doubt it's this, but it's in my head as one of the possibilities.

      Hope this helps, sorry for the delay. I was typing this reply originally and then my nvidia drivers crashed x11, and there went an hour of my life :)

      Jarland

      by Erika Heidi
      This tutorial will show you how to set up a free TLS/SSL certificate from Let’s Encrypt on a Ubuntu 16.04 server running Apache as web server. TLS certificates are used within web servers to encrypt the traffic between server and client, providing extra security for users accessing your application.

Go to https://mxtoolbox.com/DNSLookup.aspx and check both domain.com and www.domain.com and verify if they both have the same ip address(your droplet's ip address).

Hi @jarland thanks again!!

I just noticed this daily message when I SSH in: *** System restart required ***
I'm not sure what's this referring to but I restarted apache multiple times.

More importantly, when i do curl -I https://www.mydomain.com, it shows:
curl: (7) Failed to connect to www.mydomain.com port 443: Connection refused

My previous setup was with let's encrypt installed, and domain was set with www.
If I try and run curl -I http://mydomain.com i get response HTTP/1.1 200 OK and when I go there it shows this text:

<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

I'm not sure if port 80 is closed but i ran the iptables -I INPUT -p tcp --dport 80 -j ACCEPT and it didn't return anything and nothing changed on the site after that.

I reinstalled Let's Encrypt just in case, but nothing changed.
Do you maybe have a reccomendation based on the above?

Thank you SO MUCH for the time and I hopefully your graphic card drivers are going to behave from now on :)

Thank you !

Hello.

How about taking the backup of WordPress content and database through terminal (assuming the files still exists)?

Then you can migrate the whole site to the new droplet.

Praveen!

Have another answer? Share your knowledge.