Question

I have created the droplet(django one click app) and it was working good Unable to access my droplet using ipaddress now?

Posted September 19, 2019 738 views
DjangoOne-Click Install Apps

My droplet was up and running and then I added the domain name to my droplet then at first It was showing an error (BAD REQUEST(400)) then I have gone through this link to resolve that error because I was able to access the droplet using IP address but I was unable to load it using domain name:

When I connected to godaddy they have told me that you need to wait for 49 hours and after that, you will be able to access your app using domain name but their answer was unsatisfactory so I tried below steps:

https://www.digitalocean.com/community/questions/400-error-bad-request-when-visiting-domain-name-ip-address-loads-fine

After doing this my error is not resolved then I tried these steps below:
I did three things:

First, I updated my ALLOWED_HOSTS:

ALLOWEDHOSTS = [‘12.345.67.890’, 'sub.domain.com’, ’www.sub.domain.com’]
Then, I also edited the server
name setting in my nginx configuration:
server_name 12.345.67.890 sub.domain.com www.sub.domain.com;
Lastly, I restarted nginx and rebooted the machine to make sure it all worked:
sudo service nginx restart
sudo reboot

But (sudo service nginx restart) this step failed and now I am unable to access my droplet even from the IP address it is showing that my (IP address has refused to connect by using IP address and using domain name too).
I have started various steps like rebooting the droplet, load from the recovery, power cycle etc but now of that worked and I am still unable to access the droplet.

Kindly help me with this as I have started using this platform since yesterday.

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.

×
1 answer

Hello, @mishragovind973

Would you mind first checking your nginx configuration file for any syntax errors? You can do this using the following command:

nginx -t

In this way you can check if there is an error (syntax related) in the nginx file in order to fix it and make nginx back online. You can share what’s the output of the command here.

Regarding the domain name, can you please check if the domain name is resolving using this website - https://www.whatsmydns.net check for the A record, basically just enter your domain name and click the Search button.

Looking forward to your reply.
Alex

  • @ageorgiev
    The output I received is
    nginx: [emerg] unknown directive “clientmaxboy_size” in /etc/nginx/sites-enabl ed/django:12 nginx: configuration file /etc/nginx/nginx.conf test failed

    But I have resolved the error now and now it is saying that:

    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

    But still I am getting the error connection refused even after restarting the machine.

    • Thanks for getting back to me.

      May I ask if you’ve entered/typed this in the nginx file? clientmaxboysize does not ring any bells for me. All I can think about is this sounds close to “`clientmaxbodysize”` Is there any chance you’ve modified this manually?

      Looking forward to your reply.
      Alex

      • Hello Alex,

        Thank you for replying back.

        As I have modified the content of the file I have made some changes without even knowing about them as I don’t have that much good experience with editing with terminals. But now my errors are resolved as I have changes that “clientmaxboysize” to “clientmaxbodysize ” and my website is up and running with IP address and even with the domain name.

        When I have checked the nginx -t command it has told me that I have syntax error at several places and I resolved them and I got the result.

        Thanks a lot for your help and your precious time.

        Best regards,

        Govind

      • Hi @alexdo,

        I just made the mistake of putting clientmaxbody_size 100M; in http{} block and since then my website is not opening up saying; “error connection refused”.
        But there is no typo or any other mistake nginx.conf.
        What I do to solve it?

        • Hello, @mahawaqar9875

          If you’re still getting the “error connection refused” error you can first check if the domain name is resolving from the droplet, because there might be a DNS issue in first place.

          I will then recommend you to check for any syntax errors again with the command I’ve mentioned earlier

          nginx -t

          If everything is okay with the syntax you can then restart Nginx and see if the error is still present. If you’re still experiencing the problem I will recommend you to check the Nginx error_log for more detailed information about the issue.

          Let me know how it goes.

          Regards,
          Alex

Submit an Answer