Getting a 500 Internal Server Error when deploying Kirby

Hello!

I’m currently trying to deploy a project with Kirby 3 for the first time. The client uses Ionos where I set the PHP-version to 7.2 just like I did in local development.

Via FTP I was uploading the content to the root-folder of the webspace.

I immediately got an internal server error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

Things I tried:

  • Uncommenting RewriteBase / in the htaccess file.
  • Installing a clean Kirby Starterkit instead of my site.
  • Checking Memory Limit (By default this should be 256MB)
  • Checking PHP-Version (Set to 7.2 just like in my local development environment)
  • Experimented with different htaccess files. When I used any htaccess file I got an internal server error…
  • Tried basically any tip I could find in the forum

Is there any advice from you?

Many thanks!

What response do you receive when you access the site’s homepage when you delete the .htaccess file?

Also, have you checked the server error logs?

On IONOS, the RewriteBase usually has to be set like this:

RewriteBase /

Make sure that overriding server settings via the htaccess is allowed (not sure if you can or have to set this anywhere in the control panel).

What sort of a hosting package is it?

1 Like

I get a 404 Error.

Make sure mod_rewrite module enabled.

Here is my .htaccess.
I added the two lines to get php Errors by any chance (didn’t work).
The third line is to make sure Kirby gets enough memory.
The fourth is to specify a 404 Error Document because the Server Error Message mentioned that it was missing.

php_value error_reporting 7
php_flag display_errors On
php_value memory_limit 256M
ErrorDocument 404 www.google.com
# Kirby .htaccess
# Options -Multiviews
# rewrite rules
<IfModule mod_rewrite.c>

# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
# RewriteEngine on

# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
RewriteBase /page

# In some enviroments it's necessary to
# set the RewriteBase to:
#
# RewriteBase /

# block files and folders beginning with a dot, such as .git
# except for the .well-known folder, which is used for Let's Encrypt and security.txt
# RewriteRule (^|/)\.(?!well-known\/) index.php [L]

# block text files in the content folder from being accessed directly
# RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]

# block all files in the site folder from being accessed directly
# except for requests to plugin assets files
# RewriteRule ^site/(.*) index.php [L]

# Enable authentication header
# SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

# block direct access to kirby and the panel sources
# RewriteRule ^kirby/(.*) index.php [L]

# make site links work
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php [L]

</IfModule>

# compress text file responses
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

The hosting package is 1&1 Basic.

Make sure that overriding server settings via the htaccess is allowed (not sure if you can or have to set this anywhere in the control panel).

I looked for advanced settings like this as well but couldn’t find any option to do this so far.

Also, have you checked the server error logs?

There is a ‘logs’ folder in the root directory. In this FAQ it’s advised to look at the error logs as well. But other than described in the FAQ the folder structure and naming of the logs folder is entirely different.
In FTP client it looks like this:


It has its own htaccess with the following content:

Options +Indexes
RemoveHandler .html
RemoveType .html
AddType text/html .html
Satisfy any
Order Deny,Allow
Allow from 212.227.112.228
Deny from all
AuthType Basic
AuthName "Access to /logs"
AuthUserFile /kunden/homepages/XXXXXXX/htpasswd
Require user XXXXXXXXX

In the FAQ the location of the error log is described as: /var/log/httpd/error_log
Doesn’t exist here :-/

Ionos states that Apache’s mod_rewrite module is available. But to me it seems as well that the module doesn’t work…

I’d put these setting into php.ini file not the .htaccess, but anyway.

So the error has changed now from 500 Internal server error to 404 error? Or is that only because you have removed the .htaccess file?

IONOS has mod_rewrite enabled, I have installed websites there myself… Usually the only setting it needs is the RewriteBase.

Are the folder and file permissions OK?

Feel free to send me your access data via PM/mail so that I can look into it.

I finally could make it work.

I linked the domain to the subfolder in the Control Panel of Ionos. And just by trying around different htaccess settings it started working at some point.

This is my working htaccess:

# Kirby .htaccess
# Options -Multiviews
# rewrite rules
<IfModule mod_rewrite.c>

# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on

# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /mysite

# In some enviroments it's necessary to
# set the RewriteBase to:
#
RewriteBase /

# block files and folders beginning with a dot, such as .git
# except for the .well-known folder, which is used for Let's Encrypt and security.txt
RewriteRule (^|/)\.(?!well-known\/) index.php [L]

# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]

# block all files in the site folder from being accessed directly
# except for requests to plugin assets files
# RewriteRule ^site/(.*) index.php [L]

# Enable authentication header
# SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

# block direct access to kirby and the panel sources
RewriteRule ^kirby/(.*) index.php [L]

# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

</IfModule>

# compress text file responses
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

Thank you for your help! :slight_smile:

This solved my problem with error 500.

(Just saying)

1 Like