Help Needed: DevOps Task 18 - Configure LAMP Server Failing Despite Full Troubleshooting

Hi KodeKloud Team and Community,

I’m hoping to get some help with the DevOps Engineer Task 18: Configure LAMP Server. I have now attempted this lab 4 times and have run into a persistent issue that I can’t seem to get past, and I would really appreciate some guidance.

What’s confusing is that on my very first attempt, I was able to successfully configure everything and reach the WordPress installation screen by clicking the “App” button. However, on my last 3 attempts, after following what I believe are the exact same steps, the app fails to load with an ERR_EMPTY_RESPONSE error.

I have been trying to troubleshoot this methodically and wanted to share all the steps I’ve taken to solve it. I believe I have configured every layer of the architecture, but I must be missing something.

Here is a detailed summary of my complete workflow:
You can check my repo to actually see what i have tried: Click Here!

My Troubleshooting and Configuration Steps

1. Database Server (stdb01) Configuration:

  • Installed mariadb-server using yum.
  • Started and enabled the mariadb service.
  • Successfully created the required database (e.g., kodekloud_db7) and user (e.g., kodekloud_sam) with the correct password.
  • Granted all privileges to the user on the database using GRANT ALL PRIVILEGES....
  • Troubleshooting: Realizing the app servers need to connect, I also opened the firewall on the DB server for the MariaDB port:
    sudo iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
    sudo service iptables save
    

2. Application Servers (stapp01, stapp02, stapp03) Configuration:

  • On all three app servers, I installed httpd, php, and all the required dependencies (php-mysqlnd, php-json, php-pdo, etc.).
  • I correctly edited /etc/httpd/conf/httpd.conf on all three servers to change the Listen directive to the required port (e.g., 8084).
  • I started and enabled the httpd service on all three servers.
  • I correctly opened the specified port (e.g., 8084) in the firewall on all three servers using iptables.

3. WordPress Application Deployment (on one App Server):

  • On one app server, I cd’d into /var/www/html.
  • I downloaded and unpacked the latest.tar.gz from wordpress.org.
  • I moved the contents of the wordpress directory into the webroot.
  • I created wp-config.php from the sample file and correctly configured it with the database name, user, password, and the DB server’s hostname.
  • I set the ownership of /var/www/html to the apache user and group (sudo chown -R apache:apache ...).

4. Load Balancer (stlb01) Configuration:

  • I installed nginx on the LBR server.
  • Troubleshooting: I found that nginx couldn’t start because of a port conflict on port 80. I used netstat -tulpn and correctly identified that haproxy was using the port.
  • Solution: I stopped and disabled the haproxy service.
  • I then configured /etc/nginx/nginx.conf with an upstream block pointing to all three app servers on their correct port (e.g., 8084) and added the proxy_pass directive.
  • The nginx -t test was successful, and I started and enabled the nginx service.

5. SELinux Troubleshooting:

  • After doing all of the above, I was still getting the ERR_EMPTY_RESPONSE. My research suggested this could be an SELinux issue preventing Apache from making network connections.
  • Troubleshooting: I checked SELinux on the app servers. My attempts to run setsebool -P httpd_can_network_connect 1 failed because of a “managed policy” error, and getsebool was not installed. I installed policycoreutils-python-utils to get the tools.
  • Solution: After more investigation, I found that the simplest solution was to put SELinux into permissive mode on all three app servers by running sudo setenforce 0. I confirmed with getenforce that the status changed to Permissive.

Even after all of this, on my last three attempts, the “App” button still leads to the ERR_EMPTY_RESPONSE page.

Given that I was able to get it working on my first try, I’m wondering if there is some instability in the lab environment or if I am missing one final, crucial step. I have tried to be as thorough as possible.

Could anyone please review my steps and let me know what I might be missing? Any help would be greatly appreciated!

Thank you so much.

Hi KodeKloud Team and Community,

I’m hoping to get some help with the DevOps Engineer Task 18: Configure LAMP Server. I have now attempted this lab 4 times and have run into a persistent issue that I can’t seem to get past, and I would really appreciate some guidance.

What’s confusing is that on my very first attempt, I was able to successfully configure everything and reach the WordPress installation screen by clicking the “App” button. However, on my last 3 attempts, after following what I believe are the exact same steps, the app fails to load with an ERR_EMPTY_RESPONSE error.

I have been trying to troubleshoot this methodically and wanted to share all the steps I’ve taken to solve it. I believe I have configured every layer of the architecture, but I must be missing something.

Here is a detailed summary of my complete workflow:

My Troubleshooting and Configuration Steps

1. Database Server (stdb01) Configuration:

  • Installed mariadb-server using yum.
  • Started and enabled the mariadb service.
  • Successfully created the required database (e.g., kodekloud_db7) and user (e.g., kodekloud_sam) with the correct password.
  • Granted all privileges to the user on the database using GRANT ALL PRIVILEGES....
  • Troubleshooting: Realizing the app servers need to connect, I also opened the firewall on the DB server for the MariaDB port:
    sudo iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
    sudo service iptables save
    

2. Application Servers (stapp01, stapp02, stapp03) Configuration:

  • On all three app servers, I installed httpd, php, and all the required dependencies (php-mysqlnd, php-json, php-pdo, etc.).
  • I correctly edited /etc/httpd/conf/httpd.conf on all three servers to change the Listen directive to the required port (e.g., 8084).
  • I started and enabled the httpd service on all three servers.
  • I correctly opened the specified port (e.g., 8084) in the firewall on all three servers using iptables.

3. WordPress Application Deployment (on one App Server):

  • On one app server, I cd’d into /var/www/html.
  • I downloaded and unpacked the latest.tar.gz from wordpress.org.
  • I moved the contents of the wordpress directory into the webroot.
  • I created wp-config.php from the sample file and correctly configured it with the database name, user, password, and the DB server’s hostname.
  • I set the ownership of /var/www/html to the apache user and group (sudo chown -R apache:apache ...).

4. Load Balancer (stlb01) Configuration:

  • I installed nginx on the LBR server.
  • Troubleshooting: I found that nginx couldn’t start because of a port conflict on port 80. I used netstat -tulpn and correctly identified that haproxy was using the port.
  • Solution: I stopped and disabled the haproxy service.
  • I then configured /etc/nginx/nginx.conf with an upstream block pointing to all three app servers on their correct port (e.g., 8084) and added the proxy_pass directive.
  • The nginx -t test was successful, and I started and enabled the nginx service.

5. SELinux Troubleshooting:

  • After doing all of the above, I was still getting the ERR_EMPTY_RESPONSE. My research suggested this could be an SELinux issue preventing Apache from making network connections.
  • Troubleshooting: I checked SELinux on the app servers. My attempts to run setsebool -P httpd_can_network_connect 1 failed because of a “managed policy” error, and getsebool was not installed. I installed policycoreutils-python-utils to get the tools.
  • Solution: After more investigation, I found that the simplest solution was to put SELinux into permissive mode on all three app servers by running sudo setenforce 0. I confirmed with getenforce that the status changed to Permissive.

Even after all of this, on my last three attempts, the “App” button still leads to the ERR_EMPTY_RESPONSE page.

Given that I was able to get it working on my first try, I’m wondering if there is some instability in the lab environment or if I am missing one final, crucial step. I have tried to be as thorough as possible.

Could anyone please review my steps and let me know what I might be missing? Any help would be greatly appreciated!

Thank you so much.

Hi @prashantgohel

There’s someone sharing a solution using Ansible. Please review it and compare it with your answer.