Raspberry Pi3 error 500 Internal Server Error

Asked 2 years ago, Updated 2 years ago, 60 views

I just started raspberry pie. I'm building a web server while reading a book, but there's an error.

Here's what the error says.

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

Please contact the server administrator at webmaster@localhost 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.

And the code I wrote in the error file is like this. I don't know what's wrong no matter how hard I try.

#!/usr/bin/python
# # Import modules for CGI handling
import cgi, cgitb
# # Create instance of FieldStorage
form = cgi.FieldStorage()
# # Get data from fields
login_id = form.getvalue('loginid')
password = form.getvalue('password')
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Login CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s</h2>" % (login_id)
print "</body>"
print "</html>"

Where did the error occur?

python error server web raspberry-pi

2022-09-21 15:44

1 Answers

What is a web server? I think I usually use Apache a lot..

First of all, the http status code is 500 and 500 means server side error.

Of course, the meaning of server error is so extensive that it is not known if it is an error in the written code.

You should also look at Apache's logs.

It should exist in the form of /var/log/apache2/error.log.

And

cgitb.enable()

You can set it up to output debugging information.


2022-09-21 15:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.