Nginx and uwsgi Internal Server Error

3,154 views
Skip to first unread message

Jim S

unread,
Aug 4, 2014, 3:33:56 PM8/4/14
to web...@googlegroups.com
Hi

I'm getting a page that says -   Internal Server Error

whenever I try to access my server.  Here is the background.

Installed web2py/nginx/uwsgi via scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

had it running but was having a problem getting pyodbc working.

Rebooted the server

Now, whenever I try to access my site i get a page back that says -   Internal Server Error

I've checked the nginx log files, error.log is empty.

/var/log/uwsgi shows:

--- no python application found, check your startup logs for errors ---

Nothing in the web2py/logs directory.

Can someone give me an idea where I might find what is causing this Internal System Error?

FWIW, this is a brand new Ubuntu 14.04.1 server, just setup today.

-Jim

Richard Vézina

unread,
Aug 4, 2014, 3:58:20 PM8/4/14
to web2py-users
Missing dependencies...

Is the nginx-uwsgi-ubuntu script updated for 14.04 ??

Richard


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jim Steil

unread,
Aug 4, 2014, 4:00:01 PM8/4/14
to web...@googlegroups.com
I don't know.

Like I said, it worked until I rebooted after installing pyodbc.  Well, I rebooted because it wouldn't import pyodbc.  I'm going to wipe the server and try again 'after' installing pyodbc.

-Jim


You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Fkaz9N8bMh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Richard Vézina

unread,
Aug 4, 2014, 4:03:09 PM8/4/14
to web2py-users
conflic between libs...

Try remove pyodbc...

You can also just try to start uwsgi manually, maybe the startup script is not setup correctly...

sudo start uwsgi-emperor

Richard

Jim Steil

unread,
Aug 4, 2014, 4:09:09 PM8/4/14
to web...@googlegroups.com
Removed pyodbc and restarted uwsgi fixed it.

But, I still need pyodbc in my app.  Any ideas?

-Jim

Richard Vézina

unread,
Aug 4, 2014, 4:12:15 PM8/4/14
to web2py-users
virtualenv

Why you need it? Maybe you can remove this dependencies and use only pgcog2??

Richard

Jim Steil

unread,
Aug 4, 2014, 4:12:48 PM8/4/14
to web...@googlegroups.com
Accessing data on an AS/400.

Richard Vézina

unread,
Aug 4, 2014, 4:18:16 PM8/4/14
to web2py-users
Hmm I see... So you need to identify where the conflic come from... Is pyodbc installing other packages that cause issue...

Richard

Richard Vézina

unread,
Aug 4, 2014, 4:20:24 PM8/4/14
to web2py-users
https://code.google.com/p/pyodbc/wiki/FAQs

Search in page for dependency, seems there is something special to do with ubutnu requiring unixodbc to be install before pyodbc...

Richard

Richard Vézina

unread,
Aug 4, 2014, 4:21:36 PM8/4/14
to web2py-users
Also, the error you were having doesn't look like it coming from uswgi, because nginx says bad gateway message when uswgi is not working and not internal error that should coming from web2py...

Richard

Jim Steil

unread,
Aug 4, 2014, 5:05:42 PM8/4/14
to web...@googlegroups.com
FWIW - it all works fine (with pyodbc installed) if I use the rocket web server.

I'm going to do a clean install and install all of my dependencies before uwsgi.  I'll let you know how that ends up.

Jim S

unread,
Aug 4, 2014, 5:50:30 PM8/4/14
to web...@googlegroups.com
Clean install with all dependencies in place before installing nginx/uwsgi/web2py yields the same results.  It works if I don't have pyodbc installed.

Any more thoughts on what I could do for debugging?

-Jim

Marin Pranjić

unread,
Aug 4, 2014, 6:08:08 PM8/4/14
to web2py-users
Did you copy wsgihandler.py inside web2py root?

Marin


--

Jim Steil

unread,
Aug 4, 2014, 6:08:56 PM8/4/14
to web...@googlegroups.com
I did not.  I used the script in the web2py/scripts directory.


You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Fkaz9N8bMh0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

Marin Pranjić

unread,
Aug 4, 2014, 6:13:18 PM8/4/14
to web2py-users
Is uwsgi running after restart? ps aux | grep uwsgi

Jim Steil

unread,
Aug 4, 2014, 6:27:11 PM8/4/14
to web...@googlegroups.com
appears to be.  Also, keep in mind that all of this works with the rocket server...

administrator@web1-14:/home/www-data/web2py$ ps aux | grep uwsgi
root       788  0.0  0.1  39256  6380 ?        Ss   17:15   0:00 uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log
root       892  0.0  0.0  36612  1112 ?        S    17:15   0:00 uwsgi --master --die-on-term --emperor /etc/uwsgi --logto /var/log/uwsgi/uwsgi.log
www-data   893  0.0  0.4  84564 19308 ?        S    17:15   0:00 /usr/local/bin uwsgi --ini web2py.ini
www-data   996  0.0  0.3  84564 14704 ?        S    17:15   0:00 /usr/local/bin uwsgi --ini web2py.ini
www-data   997  0.0  0.3  84564 14704 ?        S    17:15   0:00 /usr/local/bin uwsgi --ini web2py.ini
www-data   998  0.0  0.3  84564 15088 ?        S    17:15   0:00 /usr/local/bin uwsgi --ini web2py.ini
www-data   999  0.0  0.3  84564 14840 ?        S    17:15   0:00 /usr/local/bin uwsgi --ini web2py.ini
adminis+  1258  0.0  0.0  11748   916 pts/0    S+   17:26   0:00 grep --color=auto uwsgi
administrator@web1-14:/home/www-data/web2py$

Marin Pranjić

unread,
Aug 4, 2014, 6:39:13 PM8/4/14
to web2py-users
Can you check again if there is wsgihandler.py inside web2py root directory?
Can you make sure sockets are created inside /tmp and www-data owns them?
What does nginx error log say when you try to make a request?

I had a 5-hour fight with uwsgi last week. It's really hard to debug it because logs don't say much about the issue. :(

Jim Steil

unread,
Aug 4, 2014, 6:50:21 PM8/4/14
to web...@googlegroups.com

I'll check those files first thing tomorrow, hinge now. There is nothing in the nginx error log.

Jim

Richard Vézina

unread,
Aug 4, 2014, 7:00:54 PM8/4/14
to web2py-users
Try install unixodbc before pyodbc as says in the link I posted above...

To me, it looks like uwsgi and nginx and web2py are running but the pyodbc make web2py failing with internal error...

Richard

Jim Steil

unread,
Aug 4, 2014, 7:02:26 PM8/4/14
to web...@googlegroups.com

Sorry, missed that not from you.

Will try tomorrow.

Jim

Jim Steil

unread,
Aug 4, 2014, 7:08:24 PM8/4/14
to web...@googlegroups.com
Ok, couldn't wait, logged in from home.  www-data does own the sockets in /tmp.

wsgihandler.py is in the web2py root directory.

Jim Steil

unread,
Aug 4, 2014, 7:09:51 PM8/4/14
to web...@googlegroups.com
Just logged in and saw that I did install unixodbc before pyodbc.  Also, this all works if I run using the rocket web server instead of nginx/uwsgi.

-Jim

Richard Vézina

unread,
Aug 5, 2014, 1:02:01 PM8/5/14
to web2py-users
Make sure everything in web2py directory is owned by www-data user : sudo chown -R www-data.www-data web2py/

Richard

Jim S

unread,
Aug 7, 2014, 3:07:01 PM8/7/14
to web...@googlegroups.com
Finally figured out my problem.

It seems to me that everything works fine if I use pip to install additional python packages.  But if I use easy_install then I get the python errors.  I 'think', but am not sure that the problem lies in some egg cache files that exist in the logged-in users home directory, but am not skilled enough to know for sure.

Anyway, the good news is that all works fine when I pip install my additional python packages.

I've got a nice big script now that installs web2py (by calling the ubuntu/nginx/uwsgi script), installs my additional ubuntu packages, python packages, adds my network mounts, and is working quite well.  Thanks to all who participated in creating the ubuntu/nginx/uwsgi script!!

-Jim

Richard Vézina

unread,
Aug 8, 2014, 9:53:22 AM8/8/14
to web2py-users
Yes Jim, it great if you come up with a ubuntu 14.04 tested script and you share with us.

Regards

Richard


Jim S

unread,
Aug 8, 2014, 10:15:46 AM8/8/14
to web...@googlegroups.com
Richard

I didn't make any changes to the script provided by web2py.  I just wrote my own script that installed all of my other dependencies first and then calls the setup-web2py-nginx-uwsgi-ubuntu.sh script.  That script worked fine for me on 14.04.1.  The point I think, is that my problems we all related to using easy_install over pip.  Once I started using pip, I never had further problems.

Thanks for offering assistance earlier on.  I really do appreciate it.

Richard Vézina

unread,
Aug 8, 2014, 10:18:11 AM8/8/14
to web2py-users
Ok got it. Yes easy_install is not recommended because you don't have a clean to uninstall package automatically...

Richard

Cliff Kachinske

unread,
Aug 8, 2014, 6:25:23 PM8/8/14
to web...@googlegroups.com
Richard,

I used the ubuntu install script on a VPS at Digital Ocean. No problem.

Richard Vézina

unread,
Aug 18, 2014, 10:34:58 AM8/18/14
to web2py-users
Good to know!

There seems to have an improved version though : https://groups.google.com/d/msg/web2py/8YWJU4FCdwg/_tm_TQKr1GQJ

Richard

Riheldo Melo

unread,
Aug 2, 2015, 12:18:12 PM8/2/15
to web2py-users
I have a similar problem!
On update of some files, change the permission.

I fix using chown -R www-data:www-data /home/www-data
Reply all
Reply to author
Forward
0 new messages