Sometime we see issues when we access our website. Suddenly it will stop working and shows the below error message:
HTTP Error 500
There are different reasons causing this issue. One of it is, Web Server is not responding when we request for the web pages. Without this, the Web Server can not deliver the requested web pages to the Client.
Let’s try to look at the issue and steps required to fix the issue.
Step 1. The simple resolution to fix HTTP 500 Error is; restart the Web Server. For example, to restart the Apache web server in Ubuntu; follow the below step(s). I have verified this with one of the bitnami’s wordpress installation.
paul:/$ sudo /opt/bitnami/ctlscript.sh restart apache
/opt/bitnami/apache2/scripts/ctl.sh : apache not running
(98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80i/bnsupport/bn
(98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
/opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started
Observe that, Apache Web Server is not able to start and showing above Errors. How to fix this? Look at the below steps.
Step 2. From above error, it seems another instance(s) of Apache Web Sever(s) are already Running and blocking some of the resources. Attempting to restart Apache server throwing the Errors. Now we will verify whether Apache is Running to listen for connections on the port 80.
Below is the command for this:
paul:/$ sudo netstat -ltnp | grep ':80'
tcp6 0 0 :::80 :::* LISTEN 8493/apache2
It is showing Apache is already running and listing at the port 80. Then, why we are NOT ABLE to see the web pages? This is because, Apache is NOT RESPONDING.
Let’s kill the Apache process and restart the Apache web server. Be careful, when you do this ON PRODUCTION Systems. If multiple sites are installed; all of the sites are going to affect with this operation.
Step 3. Kill the process by using below command:
paul:/$ kill 8493
where 8493 is the pid of the Apache2 process we got it from “Step 2“. You need to use the right process id of the process.
Step 4. Now restart the Apache Web Server using the below command.
paul:/$ sudo service apache2 restart
If the Apache Web Sever is Successfully restarted you will not see any message displayed on the screen. If any Errors; it will throw the error messages.
Step 5. Open your website in the web browser; if everything working fine; you will see your website will be displayed.
We discuss more as we go.