The issue of “403 error” can result from various reasons. In my case, it was due to the wrong installation of Let’s Encrypt SSL Certificate on the EC2 instance on AWS. After the SSL certificate setup, once the Apache server was restarted the website was down and it started showing a 403 forbidden error.
The system log was showing the following errors: ( System Log can be accessed by following the below-mentioned step on AWS graphical interface )
bitnami[1171]: /opt/bitnami/mysql/scripts/ctl.sh : mysql started at port 3306 bitnami[1171]: /opt/bitnami/php/scripts/ctl.sh : php-fpm started bitnami[1171]: Syntax OK bitnami[1171]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 bitnami[1171]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 bitnami[1171]: no listening sockets available, shutting down bitnami[1171]: AH00015: Unable to open logs bitnami[1171]: /opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started bitnami[1171]: Starting gonit daemon [[0;1;31m FAILED [0m] Failed to start LSB: bitnami init script. See 'systemctl status bitnami.service' for details.
I used the command below:
systemctl status bitnami.service
The output of the above command was:
● bitnami.service - LSB: bitnami init script Loaded: loaded (/etc/init.d/bitnami; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2019-01-20 06:11:04 UTC; 5h 4min ago Process: 1171 ExecStart=/etc/init.d/bitnami start (code=exited, status=3) Tasks: 38 Memory: 223.8M CPU: 19.277s CGroup: /system.slice/bitnami.service ├─1442 /bin/sh /opt/bitnami/mysql/bin/mysqld_safe --defaults-file=/opt/bitnami/mysql/my.cnf --mysqld=mysqld.bin --socket=/opt/bitnami/mysql/tmp/mysql.sock - ├─1791 /opt/bitnami/mysql/bin/mysqld.bin --defaults-file=/opt/bitnami/mysql/my.cnf --basedir=/opt/bitnami/mysql --datadir=/opt/bitnami/mysql/data --plugin-d ├─1866 php-fpm: master process (/opt/bitnami/php/etc/php-fpm.conf) ├─1867 php-fpm: pool wordpress └─1966 /usr/bin/gonit bitnami[1171]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80 bitnami[1171]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80 bitnami[1171]: no listening sockets available, shutting down bitnami[1171]: AH00015: Unable to open logs bitnami[1171]: /opt/bitnami/apache2/scripts/ctl.sh : httpd could not be started bitnami[1171]: Starting gonit daemon systemd[1]: bitnami.service: Control process exited, code=exited status=3 systemd[1]: Failed to start LSB: bitnami init script. systemd[1]: bitnami.service: Unit entered failed state. systemd[1]: bitnami.service: Failed with result 'exit-code'.
It was obvious that port 80 was being used by some other process. To find out which process was using it, I used the “netstat” command.
sudo netstat -ltnp sudo netstat -ltnp | grep :port_number
It was nginx which was using the port 80. Since I was not using the nginx, I had to stop and restart the apache inside bitnami.
sudo pkill -f nginx sudo pkill -f apache sudo /opt/bitnami/ctlscript.sh start apache
Useful Resources:
Leave a Reply