Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Aug 13, 2013 2:18 am 
Offline
Senior Newbie

Joined: Thu Aug 08, 2013 10:23 am
Posts: 6
Dear all, (copy from another forum, quote Tim's comment partially).

I am running a site through Linode Server. The recent maintenance change caused an error in some setting I cannot understand. The Linode Management panel says that everything is running, but when I look at the site and try to access it I get the following error

502 Bad Gateway
nginx/0.7.67

I have no clue what it is and Linode support basically say they do not understand it either and cannot help.

I have been working with the Putty thing and do get some access, but from there ( the sites prompt $) I do not understand how to move further.

Further, the site is running, but I would like to get all the files, and see how new developments can be carried out on it. The site is created in Python and Django.
Anyone with expertise on that?

Tim advised": "to configere the web application to start automatically at boot. It sounds like my web server, Nginx, is unable to communicate with the backend web application."

However, I have no clue what that is, how to get access and what the variables are for setting this to auto boot once Linode server is rebooted.

:?

William Goossen


Top
   
PostPosted: Tue Aug 13, 2013 3:03 am 
Offline
Senior Member

Joined: Fri Jul 03, 2009 2:31 am
Posts: 54
ICQ: 897607
Your Django application needs to be run by an application server. This could be Apache with mod_wsgi, or gunicorn, or the uWSGI nginx module. The last two (gunicorn and uWSGI) need nginx to handle the incoming browser requests. Apache + mod_wsgi don't require nginx but they still run better with it anyway.

When nginx receives a request from a browser it passes that request to your application server. If it can't reach the application server then it returns the 502 Bad Gateway error to the browser.

So, in a nutshell, you appear to have nginx started but no application server.

To make things easy for now you should just run nginx with gunicorn as your app server. Some decent instructions for setting this up can be found at http://michal.karzynski.pl/blog/2013/06 ... upervisor/


Top
   
PostPosted: Tue Aug 13, 2013 4:02 pm 
Offline
Senior Newbie

Joined: Thu Aug 08, 2013 10:23 am
Posts: 6
Dear Michal,

Your instructions helped me to dig deeper into the server itself, I used additional guidance on basic unix commands to move between directories and list the files.
Apparently the sudo command you suggested to restart nginx did work for the restart, but the website is still showing the same message. Also a sudo reboot command did let the application server reboot, but still no success in accessing the website.

Perhaps I need to do more, but then the link you provided is showing too many options I guess. And the gunicorn is also completely new and has not been in place before. So I am not sure I need it at all. So any further help would be appreciated very much.

In particular, how can I find and restart the application server? :?:

In the meanwhile, with other commands to read the log file, I could detect one error in the nginx error log file:

2013/08/13 21:16:40 [error] 1676#0: *1 connect() failed (111: Connection refused ) while connecting to upstream, client: 86.81.201.17, server: r4c.clinicaltemplates.org, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:8082", host: "r4c.clinicaltemplates.org"

Perhaps this points to the next step? But again, I do not know where to go.

William


Top
   
PostPosted: Mon Aug 19, 2013 1:48 am 
Offline
Senior Newbie

Joined: Thu Aug 08, 2013 10:23 am
Posts: 6
Hi all,

I got it solved and the site is running again as ever before. The issue was that I typed in nginx restart, which should have been nginx start.... Oh well, I learned a lot.

Thanks for your help, which made me confident to explore some options!

William


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group