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-serverusingyum. - Started and enabled the
mariadbservice. - 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.confon all three servers to change theListendirective to the required port (e.g.,8084). - I started and enabled the
httpdservice on all three servers. - I correctly opened the specified port (e.g.,
8084) in the firewall on all three servers usingiptables.
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.gzfrom wordpress.org. - I moved the contents of the
wordpressdirectory into the webroot. - I created
wp-config.phpfrom 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/htmlto theapacheuser and group (sudo chown -R apache:apache ...).
4. Load Balancer (stlb01) Configuration:
- I installed
nginxon the LBR server. -
Troubleshooting: I found that
nginxcouldn’t start because of a port conflict on port 80. I usednetstat -tulpnand correctly identified thathaproxywas using the port. -
Solution: I stopped and disabled the
haproxyservice. - I then configured
/etc/nginx/nginx.confwith anupstreamblock pointing to all three app servers on their correct port (e.g.,8084) and added theproxy_passdirective. - The
nginx -ttest was successful, and I started and enabled thenginxservice.
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 1failed because of a “managed policy” error, andgetseboolwas not installed. I installedpolicycoreutils-python-utilsto 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 withgetenforcethat the status changed toPermissive.
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.
