Nginx Troubleshoots

Find open logfiles without knowing the configuration

Sometimes you don't know where's the log of nginx

find PID of httpd (same concept applies for nginx and other programs):

# ps axu |grep httpd
root 17970 0.0 0.3 495964 64388 ? Ssl Oct29 3:45 /usr/sbin/httpd

Then search for open logfiles using lsof for the PID:

# lsof -p 17970 |grep log
httpd 17970 root 2w REG 253,15 2278 6723 /var/log/httpd/error_log
httpd 17970 root 12w REG 253,15 0 1387 /var/log/httpd/access_log

Invalid pid number

As I tried to renew my certbot, I tried to stop nginx but it just shows error, Invalid pid number...

# to list all nginx process
ps -ef | grep nginx
kill -9 {number in here it would be 30891}

Just kill all nginx then service nginx restart. or...

sudo pkill -f nginx & wait $!
sudo systemctl start nginx

Unable to load your default controller

I was testing my CI in Nginx from Apache and this what happened

Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid

What happened is when you're using HMVC sometimes people delete their default controller, model or even library folder, In apache maybe it's okay but not in Nginx. Thanks

This site can’t be reached

When using Https sometime you need to check, usually in AWS you need to add rules in the network

Subscribe to You Live What You Learn

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]