Kiyoko
Kiyoko

Reputation: 11

Custom HTTP 500 Error Page for Bitnami LAMP stack on AWS Lightsail

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

enter image description here

However, when I visit a page where I intentionally put a bug in some PHP code, the custom 500 error message does not display.

enter image description here

enter image description here

Relevant portion of my /opt/bitnami/apache/conf/httpd.conf file:

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache/htdocs"
  <Directory "/opt/bitnami/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  # Error Documents
  ErrorDocument 500 "The server made a boo boo. (bitnami.conf)"
  ErrorDocument 404 "We can't find the page (bitnami.conf)"
  ErrorDocument 503 /503.html
</VirtualHost>

Relevant portion of my /opt/bitnami/apache/conf/bitnami/bitnami.conf file:

<VirtualHost _default_:80>
  DocumentRoot "/opt/bitnami/apache/htdocs"
  <Directory "/opt/bitnami/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  # Error Documents
  ErrorDocument 500 "The server made a boo boo. (bitnami.conf)"
  ErrorDocument 404 "We can't find the page (bitnami.conf)"
  ErrorDocument 503 /503.html
</VirtualHost>

Relevant portion of my /opt/bitnami/apache/conf/bitnami/bitnami-ssl.conf file:

<VirtualHost _default_:443>
  DocumentRoot "/opt/bitnami/apache/htdocs"
  SSLEngine on
  SSLCertificateFile "/opt/bitnami/apache/conf/bitnami/certs/server.crt"
  SSLCertificateKeyFile "/opt/bitnami/apache/conf/bitnami/certs/server.key"

  <Directory "/opt/bitnami/apache/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  # Error Documents
  ErrorDocument 500 "The server made a boo boo. (bitnami-ssl.conf)"
  ErrorDocument 404 "We can't find the page (bitnami-ssl.conf)"
  ErrorDocument 503 /503.html
</VirtualHost>

Upvotes: 0

Views: 74

Answers (1)

Sladjan Ilic
Sladjan Ilic

Reputation: 11

Did you restart Apache for the changes in httpd.conf to take effect?

sudo /opt/bitnami/ctlscript.sh restart apache

Upvotes: 0

Related Questions