Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 10th December 2010, 14:03
Drex56 Drex56 is offline
Junior Member
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 2 Times in 2 Posts
Question The Perfect SpamSnake - Ubuntu Jeos 10.04 - Nginx, uWSGI & Baruwa

Hi All,

wondering if any of you can give me a hand as im slowly frying my brain with this. My problem is as follows, I have setup MailScanner no problems, works fine, its just the Nginx, uWsgi and baruwa combination that are giving me headaches. I know im not using the prescribed 10.10 but it wasn't an option and I quite like LTS. Basically I have setup as per the how-to (associated conf and ini files below) and all I get at the moment is:

uWSGI Error
wsgi application not found


/etc/uwsgi/uwsgi-python2.6/baruwa.ini:

[uwsgi]
socket = /var/run/uwsgi/uwsgi-python2.6/baruwa/socket
master = true
processes = 2
env = DJANGO_SETTINGS_MODULE=baruwa.settings
module = django.core.handlers.wsgi:WSGIHandler()

/etc/nginx/sites-available/baruwa.conf:

server {
listen 80;
server_name exam.example.com;
root /usr/share/pyshared/baruwa;
#main access log
access_log /var/log/nginx/access.log;
#main error log
error_log /var/log/nginx/error.log;
location /static {
root /usr/share/pyshared/baruwa/static/;
}
# static resources
location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar |bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp| rtf|js)$
{
expires 30d;
break;
}
location / {
uwsgi_pass unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/socket;
include uwsgi_params;
}
}

One thing that is obvious is the socket, before everyone shouts at once a
"ls /var/run/uwsgi/uwsgi-python2.6/baruwa" returns:

pid socket

Hence the change from 'baruwa.sock' to 'socket'.

Please let me know if there is anymore information you need or if you would like me to test anything.

Thanks Muchly,

Drex

Last edited by Drex56; 13th December 2010 at 11:56.
Reply With Quote
Sponsored Links
  #2  
Old 10th December 2010, 23:07
Rocky Rocky is offline
Senior Member
 
Join Date: Oct 2005
Posts: 553
Thanks: 14
Thanked 49 Times in 48 Posts
Default

Hey,

Try this in your baruwa.ini:
pythonpath = /usr/share/pyshared/baruwa/

Restart nginx and uwsgi.

Let me know if that worked.
__________________
Home of the SpamSnake
Reply With Quote
  #3  
Old 11th December 2010, 16:47
Drex56 Drex56 is offline
Junior Member
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi Rocky,

Thanks for the suggestion, unfortunately, still a no-go, I have noticed this, however, when I restart uwsgi:

Code:
# /etc/init.d/uwsgi-python2.6 restart
 * Restarting WSGI server(s) uwsgi-python2.6
                                    /etc/init.d/uwsgi-python2.6: 109: Bad substitution
                                    /etc/init.d/uwsgi-python2.6: 109: Bad substitution
                                    /etc/init.d/uwsgi-python2.6: 109: Bad substitution
Is this anything that I should be worrying about? related at all?

Anyway my
Code:
/etc/uwsgi/uwsgi-python2.6/baruwa.ini
now looks like this:

Code:
[uwsgi]
   socket = /var/run/uwsgi/uwsgi-python2.6/baruwa/socket
   master = true
   processes = 2
   env = DJANGO_SETTINGS_MODULE=baruwa.settings
   module = django.core.handlers.wsgi:WSGIHandler()
   pythonpath = /usr/share/pyshared/baruwa/
Oh regarding the above uwsgi-python error, my
Code:
/etc/init.d/uwsgi-python2.6
looks like this:

Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          uwsgi-python2.6
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop uwsgi-python2.6 server instance(s)
### END INIT INFO

# Author: Leonid Borisenko <leo.borisenko@gmail.com>

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="WSGI server(s)"             # Introduce a short description here
NAME="uwsgi-python2.6"           # Introduce the short server's name here
DAEMON=/usr/bin/uwsgi-python2.6  # Introduce the server's location here
SCRIPTNAME=/etc/init.d/$NAME
CONFDIR=/etc/uwsgi/uwsgi-python2.6

RUNDIR=/var/run/uwsgi
UWSGI_RUNDIR=$RUNDIR/uwsgi-python2.6

LOGDIR=/var/log/uwsgi
UWSGI_LOGDIR=$LOGDIR/uwsgi-python2.6
LOG_FILENAME_SUFFIX=uwsgi-python2.6

# Exit if the package is not installed
[ -x $DAEMON ] || exit 0

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Define supplementary functions
. /usr/lib/uwsgi/init/snippets
. /usr/lib/uwsgi/init/do_command

WHAT=$1
shift
case "$WHAT" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  status)
    if [ -z "$1" ]; then
      [ "$VERBOSE" != no ] && log_failure_msg "which one?"
    else
      status_of_proc -p $(find_specific_pidfile $1) "$DAEMON" "$NAME" \
        && exit 0 \
        || exit $?
    fi
  ;;

  reload)
    [ "$VERBOSE" != no ] && log_daemon_msg "Reloading $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  force-reload)
    [ "$VERBOSE" != no ] && log_daemon_msg "Forced reloading $DESC" "$NAME"
    do_command "$WHAT" "$@"
    RETVAL="$?"
    [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
  ;;

  restart)
    [ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
    CURRENT_VERBOSE=$VERBOSE
    VERBOSE=no
    do_command stop "$@"
    VERBOSE=$CURRENT_VERBOSE
    case "$?" in
      0)
        do_command start "$@"
        RETVAL="$?"
        [ "$VERBOSE" != no ] && log_end_msg "$RETVAL"
      ;;
      *)
        # Failed to stop
        [ "$VERBOSE" != no ] && log_end_msg 1
      ;;
    esac
  ;;

  *)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
    exit 3
  ;;
esac
Thanks Muchly,

Drex

Last edited by Drex56; 11th December 2010 at 16:48. Reason: Spelling errors :S
Reply With Quote
  #4  
Old 11th December 2010, 19:11
Rocky Rocky is offline
Senior Member
 
Join Date: Oct 2005
Posts: 553
Thanks: 14
Thanked 49 Times in 48 Posts
Default

Change the socket back to baruwa.sock, try to restart and see what happens. I haven't seen that error and not sure why it's happening right now. I'll dig some more. Have you altered anything with uwsgi/nginx after the setup beside the ini and conf files?
__________________
Home of the SpamSnake
Reply With Quote
  #5  
Old 11th December 2010, 21:30
Drex56 Drex56 is offline
Junior Member
 
Join Date: May 2010
Posts: 16
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Hi Rocky,

Well changed baruwa.ini and baruwa.conf back to baruwa.sock and restart bout uWSGI and nginx (in that order) and now have a lovely "502 gateway" error.

This is the error I initailly cam across when I started everything up which led me to change the socket to "socket".

Other than that everything is set as per the guide.

Thanks for all your help thus far, I spent a long time trying to google the error before posting and couldn't find anything or relevance on it.

Thanks,

Drex
Reply With Quote
  #6  
Old 12th December 2010, 03:43
Rocky Rocky is offline
Senior Member
 
Join Date: Oct 2005
Posts: 553
Thanks: 14
Thanked 49 Times in 48 Posts
Default

Does this folder exist in your setup?
/var/run/uwsgi/uwsgi-python2.6/baruwa/

Change the socket line to /tmp/baruwa.sock in your ini and conf file and see what happens.

What's in your uwsgi-python2.6 log file?
__________________
Home of the SpamSnake
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Clamav issue with The Perfect SpamSnake - Ubuntu Jeos 9.10 Maxum HOWTO-Related Questions 7 21st March 2011 16:21
Connection timed out on intermail outgoing mails gouravgarg Server Operation 6 5th March 2010 20:31
MailScanner trouble with DBD-MYSQL sergio.arnaldo Server Operation 11 26th August 2009 18:08
Howtoforge the perfect Server(links) rini90 Installation/Configuration 0 14th December 2008 10:58
SpamSnake SpamAssassin not working? getrav HOWTO-Related Questions 5 23rd June 2008 23:02


All times are GMT +2. The time now is 19:38.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.