Closed kotobakards closed 2 weeks ago
Hi @kotobakards,
You deployed a WordPress app on top of the LAMP solution and it's probably managing the errors by itself. You will need to take a look at the app's documentation to get more information about that.
Regarding the Apache's conf files to edit, the changes you made in the bitnami.conf and bitnami-ssl.conf files should be enough.
@jotamartos - I definitely didn't deploy a WordPress site, unless it came with the image? I do have other WordPress instances in my Lightsail account, but I spun up this LAMP stack instance specifically for testing the 5XX error messages.
I had started on a different LAMP instance that I had been using for a while. When I couldn't get the 500 error message to show on that instance, I created a new fresh instance in case it was in fact something that was already installed on the server that was interfering. The screenshots in my original comment are from that brand new instance.
Screenshot showing that I'm using a LAMP image through Lightsail instead of the WordPress one.
Loom video demonstrating the issue. https://www.loom.com/share/3607dbd327744d9282bf4b611a864cd6
Hi @kotobakards,
Sorry, I thought it was a WordPress app when I accessed your domain. I just performed a quick test and deployed a sample "Hello world" website using PHP under apache/htdocs. I also edited the apache/conf/bitnami/bitnami.conf file (I didn't configure http->https redirections) and added the line to manage the 404 errors
...
# Error Documents
ErrorDocument 503 /503.html
ErrorDocument 404 "Oops! We can't find that file. Sorry."
</VirtualHost>
Include "/opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf"
The test succeeded
$ curl -LI localhost/index2.php
HTTP/1.1 404 Not Found
Date: Thu, 23 May 2024 07:37:32 GMT
Server: Apache
Content-Type: text/html; charset=iso-8859-1
In your case, the app may be managing the errors and that's why you get the app's error message instead of the one you configured in Apache. You will need to review that.
@jotamartos - thanks for getting back to me! Please see the previously provided screenshots and Loom video.
On the test instance you deployed, can you get the 500 error message to show if you have a bug in your PHP code (such as a missing semicolon)?
On the test instance you deployed, can you get the 500 error message to show if you have a bug in your PHP code (such as a missing semicolon)?
I get the 500 error code but Apache doesn't show the custom error.
$ curl localhost/index.php
$ curl -LI localhost/index.php
HTTP/1.1 500 Internal Server Error
Date: Mon, 27 May 2024 08:17:46 GMT
Server: Apache
Connection: close
Content-Type: text/html; charset=UTF-8
I do not know why Apache is not managing the error the way we configured. I suggest you take a look at the documentation and the forums online to get more information about why Apache doesn't manage that the expected way.
This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.
Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.
Platform
AWS
bndiagnostic ID know more about bndiagnostic ID
02399490-027a-7d25-a11d-c3d3b72745f1
bndiagnostic output
===== Begin of bndiagnostic tool output =====
bndiagnostic was not useful. Could you please tell us why?
None of the output categories were related to my issue
Describe your issue as much as you can
I'd like to display a custom error page for HTTP 5XX errors. However, for now I would settle with just displaying a custom message (let alone trying to display an actual error page). I can get the custom error message to display for 4XX errors, but not for 5XX errors.
When I visit a page that I know doesn't exist on the server, the custom 404 message displays.![image](https://github.com/bitnami/vms/assets/148245090/96bf45bf-c10e-4468-8a35-4ff51d056e99)
However, when I visit a page where I intentionally put a bug in some PHP code, the custom 500 error message does not display.
![image](https://github.com/bitnami/vms/assets/148245090/3fe95e20-5d7a-47d1-a528-6fb617935e95)
Relevant portion of my /opt/bitnami/apache/conf/httpd.conf file:
Relevant portion of my /opt/bitnami/apache/conf/bitnami/bitnami.conf file:
Relevant portion of my /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf file: