What to do if a "505 Internal Server" error occurs on Sakura's rental server
Mojolicious applications can run locally, but often don't work when I upload them to a rental server and try to run them as CGI. The following causes are possible, so let's deal with them in order.
404 Not Found is displayed
The URL is incorrect. Enter the correct URL in your browser.
The contents of the script are displayed
Is the extension other than ".cgi"? It will not be executed as a CGI script without the ".cgi" extension.
Module not loaded
In your local environment, the CPAN module may be present, but not on the server. If you add the following description to the beginning of the script, the error content when loading fails will be displayed.
use CGI::Carp 'fatalsToBrowser';
Line feed code conversion error
When uploading an application from Windows to a rental server, you need to convert the line feed code. Make sure you are transferring in ASCII mode. Only app.cgi needs to be transferred in ASCII mode. For other scripts, it doesn't matter which mode you use.
CGI script does not have execute permission
If the CGI script does not have execute permission, an error will occur. Make sure that the execution permission of the CGI script is 755 (in the case of suEXEC environment. Sakura rental server is in the suEXEC environment). You only need to change the permissions of app.cgi, other files are fine.
Perl path error on the first line
An error will occur if the Perl path on the first line is incorrect.
# !/usr/bin/perl