librelist archives

« back to archive

error: 502 bad gateway in flask app on nginx and uwsgi

error: 502 bad gateway in flask app on nginx and uwsgi

From:
Kundan Singh
Date:
2013-05-19 @ 11:35
I am deploying a flask app on Ubuntu server using Nginix, uWSGI. I followed
this tutorial...http://www.soundrenalin.com/about

I am beginner in Nignix and Sys Admin.

But when i run my app it gives error: 502 Bad Gateway

I looked into log file and it says:

Starting uWSGI 1.2.3-debian (32bit) on [Sun May 19 05:39:19 2013]
***compiled with version: 4.7.1 on 17 September 2012 17:20:40 detected
number of CPU cores: 1 current working directory:
/etc/uwsgi/apps-enabled detected binary path: /usr/bin/uwsgi-core your
memory page size is 4096 bytes detected max file descriptor number:
1024
lock engine: pthread robust mutexesunlink(): Operation not permitted
[socket.c line 75]
bind(): Address already in use [socket.c line 107] removed uwsgi
instance flaskapp.ini

Why this is happening? Please Suggest

Regards!!!

Kundan Singh

Re: [flask] error: 502 bad gateway in flask app on nginx and uwsgi

From:
Roberto De Ioris
Date:
2013-05-19 @ 11:46
> I am deploying a flask app on Ubuntu server using Nginix, uWSGI. I
> followed
> this tutorial...http://www.soundrenalin.com/about
>
> I am beginner in Nignix and Sys Admin.
>
> But when i run my app it gives error: 502 Bad Gateway
>
> I looked into log file and it says:
>
> Starting uWSGI 1.2.3-debian (32bit) on [Sun May 19 05:39:19 2013]
> ***compiled with version: 4.7.1 on 17 September 2012 17:20:40 detected
> number of CPU cores: 1 current working directory:
> /etc/uwsgi/apps-enabled detected binary path: /usr/bin/uwsgi-core your
> memory page size is 4096 bytes detected max file descriptor number:
> 1024
> lock engine: pthread robust mutexesunlink(): Operation not permitted
> [socket.c line 75]
> bind(): Address already in use [socket.c line 107] removed uwsgi
> instance flaskapp.ini
>
> Why this is happening? Please Suggest
>
> Regards!!!
>
> Kundan Singh
>

Check /tmp/uwsgi.sock permissions, very probably it is owned by a user
different from www-data

-- 
Roberto De Ioris
http://unbit.it

Re: [flask] error: 502 bad gateway in flask app on nginx and uwsgi

From:
Kundan Singh
Date:
2013-05-19 @ 15:14
I have tried chaning *www-data* to *myusername * in uwsgi config file but
still no change...same 502 error


On Sun, May 19, 2013 at 5:16 PM, Roberto De Ioris <roberto@unbit.it> wrote:

>
> > I am deploying a flask app on Ubuntu server using Nginix, uWSGI. I
> > followed
> > this tutorial...http://www.soundrenalin.com/about
> >
> > I am beginner in Nignix and Sys Admin.
> >
> > But when i run my app it gives error: 502 Bad Gateway
> >
> > I looked into log file and it says:
> >
> > Starting uWSGI 1.2.3-debian (32bit) on [Sun May 19 05:39:19 2013]
> > ***compiled with version: 4.7.1 on 17 September 2012 17:20:40 detected
> > number of CPU cores: 1 current working directory:
> > /etc/uwsgi/apps-enabled detected binary path: /usr/bin/uwsgi-core your
> > memory page size is 4096 bytes detected max file descriptor number:
> > 1024
> > lock engine: pthread robust mutexesunlink(): Operation not permitted
> > [socket.c line 75]
> > bind(): Address already in use [socket.c line 107] removed uwsgi
> > instance flaskapp.ini
> >
> > Why this is happening? Please Suggest
> >
> > Regards!!!
> >
> > Kundan Singh
> >
>
> Check /tmp/uwsgi.sock permissions, very probably it is owned by a user
> different from www-data
>
> --
> Roberto De Ioris
> http://unbit.it
>

Re: [flask] error: 502 bad gateway in flask app on nginx and uwsgi

From:
Roberto De Ioris
Date:
2013-05-20 @ 04:56
> I have tried chaning *www-data* to *myusername * in uwsgi config file but
> still no change...same 502 error

This is not what i meant, your problem is the inhabiity to remove the
already existent /tmp/uwsgi.sock. You have to change its permissions
accordingly.

Honestly i suggest to newcomers to use tcp sockets as they do not need
permissions


>
>
> On Sun, May 19, 2013 at 5:16 PM, Roberto De Ioris <roberto@unbit.it>
> wrote:
>
>>
>> > I am deploying a flask app on Ubuntu server using Nginix, uWSGI. I
>> > followed
>> > this tutorial...http://www.soundrenalin.com/about
>> >
>> > I am beginner in Nignix and Sys Admin.
>> >
>> > But when i run my app it gives error: 502 Bad Gateway
>> >
>> > I looked into log file and it says:
>> >
>> > Starting uWSGI 1.2.3-debian (32bit) on [Sun May 19 05:39:19 2013]
>> > ***compiled with version: 4.7.1 on 17 September 2012 17:20:40 detected
>> > number of CPU cores: 1 current working directory:
>> > /etc/uwsgi/apps-enabled detected binary path: /usr/bin/uwsgi-core your
>> > memory page size is 4096 bytes detected max file descriptor number:
>> > 1024
>> > lock engine: pthread robust mutexesunlink(): Operation not permitted
>> > [socket.c line 75]
>> > bind(): Address already in use [socket.c line 107] removed uwsgi
>> > instance flaskapp.ini
>> >
>> > Why this is happening? Please Suggest
>> >
>> > Regards!!!
>> >
>> > Kundan Singh
>> >
>>
>> Check /tmp/uwsgi.sock permissions, very probably it is owned by a user
>> different from www-data
>>
>> --
>> Roberto De Ioris
>> http://unbit.it
>>
>


-- 
Roberto De Ioris
http://unbit.it