Question

HTTP/1.1 500 Internal Server Error

Hi,

i’ve set up my django app with postgres, gunicorn and nginx, and it was working perfectly for more than a month, yesterday and when i tried to access the website, it gaves me Internal Server Error while i didn’t change anything, so i checked the nginx logs and here are the results :

2023/01/27 14:09:15 [crit] 1094411#1094411: *3723 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 162.243.141.20, server: 0.0.0.0:443
2023/01/27 16:30:17 [alert] 1124567#1124567: *8 open socket #3 left in connection 4
2023/01/27 16:30:17 [alert] 1124567#1124567: *9 open socket #12 left in connection 5
2023/01/27 16:30:17 [alert] 1124567#1124567: aborting

and i’m not sure if the SSL has something to do with it since i had that error before, but one thing that i actually noticed is that when i checked the status of apache2.service, it says Failed to start The Apache HTTP Server., but i think it’s normal since i’m using nginx right ?, here is what i get :

**×** apache2.service - The Apache HTTP Server

     Loaded: loaded (/lib/systemd/system/apache2.service; **enabled**; preset: **enabled**)

     Active: **failed** (Result: exit-code) since Sat 2022-11-26 17:00:32 UTC; 2 months 1 day ago

       Docs: https://httpd.apache.org/docs/2.4/

        CPU: 34ms

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[9000]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[9000]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[9000]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[9000]: no listening sockets available, shutting down

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[9000]: AH00015: Unable to open logs

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[8984]: Action 'start' failed.

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 apachectl[8984]: The Apache error log may have more information.

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: **apache2.service: Control process exited, code=exited, status=1/FAILURE**

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: **apache2.service: Failed with result 'exit-code'.**

Nov 26 17:00:32 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: **Failed to start The Apache HTTP Server.**

So i tried to check the error logs of apache2 using :

sudo tail -n 2 /var/log/apache2/error.log

but it returns nothing,

btw : nginx and gunicorn status are all active and everything looks good, i tried to restart them but i still get the error.

so can someone please help me with this and let me know what should i do ? i’m a beginner into this and just started learning. thanks and i really appreciate your help.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
February 1, 2023

Hi @sleepingnavyseal,

Apache2 is failing because something is listening on port 80 already, I would assume the Nginx.

Additionally, I’m not sure why you would need Apache and Nginx configured. I would assume it’s Nginx what you are using for a reverse proxy to your gunicorn application. One other thing that leads me to belive that is that Apache has been down for 2 months :

Active: **failed** (Result: exit-code) since Sat 2022-11-26 17:00:32 UTC; 2 months 1 day ago

so yes, it’s Nginx that you are using.

Now, the error you see in Nginx :

2023/01/27 14:09:15 [crit] 1094411#1094411: *3723 SSL_do_handshake() failed (SSL: error:0A00006C:SSL routines::bad key share) while SSL handshaking, client: 162.243.141.20, server: 0.0.0.0:443

Upon reading on the error it seems the error is related to your Application rather than Nginx. Basically, check your  “JWT_SECRET_KEY” is being read correctly.

Additionally, check your SSL and if it has expired.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up