Ubuntu 10.10 SpamSnake .. 502 Bad Gateway

Discussion in 'HOWTO-Related Questions' started by RoboBunny, Feb 4, 2011.

  1. RoboBunny

    RoboBunny New Member

    Hi

    I followed Rocky's
    http://www.howtoforge.com/the-perfect-spamsnake-ubuntu-jeos-10.10-maverick-meerkat-p3

    Now when I try to go to the webpage i get 502 Bad Gateway.

    http://192.168.1.252:8080/accounts/login/?next=/

    Not displaying BARUWA website I did check....
    http://www.howtoforge.com/forums/showthread.php?t=50330
    it did not help..

    tail -f /var/log/nginx/error.log
    **
    2011/02/04 13:34:21 [error] 25272#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.252, server: mail.mysite.co.za, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "mail.mysite.co.za:8080"

    2011/02/04 13:46:26 [error] 25272#0: *4 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.252, server: mail.mysite.co.za, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "192.168.1.252:8080"

    2011/02/04 13:46:26 [error] 25272#0: *4 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.1.252, server: mail.mysite.co.za, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.252:8080"

    2011/02/04 13:46:29 [error] 25272#0: *4 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.1.252, server: mail.mysite.co.za, request: "GET /favicon.ico HTTP/1.1", host: "192.168.1.252:8080"

    2011/02/04 13:49:24 [error] 25272#0: *7 upstream prematurely closed connection while reading response header from upstream, client: 192.168.1.252, server: mail.mysite.co.za, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "192.168.1.252:8080"
    **

    tail -f /var/log/nginx/access.log

    **
    92.168.1.252 - - [04/Feb/2011:13:46:26 +0200] "GET / HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    192.168.1.252 - - [04/Feb/2011:13:46:26 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 502 172 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    192.168.1.252 - - [04/Feb/2011:13:46:26 +0200] "GET /favicon.ico HTTP/1.1" 404 142 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    192.168.1.252 - - [04/Feb/2011:13:46:29 +0200] "GET /favicon.ico HTTP/1.1" 404 142 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    192.168.1.252 - - [04/Feb/2011:13:49:24 +0200] "GET / HTTP/1.1" 302 5 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    192.168.1.252 - - [04/Feb/2011:13:49:24 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 502 172 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    **

    tail -f /var/log/nginx/localhost.access.log

    **
    ::1 - - [04/Feb/2011:10:06:20 +0200] "GET / HTTP/1.1" 403 143 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    ::1 - - [04/Feb/2011:10:08:23 +0200] "GET / HTTP/1.1" 403 143 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    ::1 - - [04/Feb/2011:13:22:59 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 404 143 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    ::1 - - [04/Feb/2011:13:34:08 +0200] "GET /accounts/login/?next=/ HTTP/1.1" 404 143 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    ::1 - - [04/Feb/2011:13:34:12 +0200] "GET / HTTP/1.1" 403 143 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10"
    **

    I got the following that is why I'm running on port 8080:
    root@mail:/usr/src# /etc/init.d/uwsgi-python2.6 restart && /etc/init.d/nginx restart
    * Restarting WSGI server(s) uwsgi-python2.6 [ OK ]
    Restarting nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] still could not bind()
    nginx.

    I did double check for same problem form other people but no luck.

    Please if anyone can help I would greatly appreciate it

    RoboBunny
     
  2. Rocky

    Rocky New Member

    Do you by chance have any other web servers running?
     
  3. RoboBunny

    RoboBunny New Member

    Thanks for the reply Rocky.

    I managed to get it working but its not exactly what I was looking for.
    Can I ask you a favor? Would you mind doing a "How to" for the setup of a
    Ubuntu 10.10 or CentOS 5.5 with virtual users etc....:

    Apache + Postfix + Mysql + Postfix Admin + Dovecot + MailScanner + Mailwatch + Sqlgrey + SpamAssassin + Clamav + Squirrelmail
    ------> http://www.example42.com/puppet/toaster-mailscanner.php

    Or just a "How to" for a MailScanner setup (Ubuntu 10.10 or CentOS 5.5)
    Apache + Postfix + Mysql + Dovecot + MailScanner + Mailwatch + SpamAssassin + Clamav

    I need to pull mail from a external pop/imap server (like google, local ISP or pop.mailserver.com) for local or virtual users, the mail should be able to route internally and if not found relay to a external smtp server (like google, local ISP or smtp.mailserver.com)... but i want to use mailscanner with mail watch or baruwa for scanning mails and i need apache for another site configured for apache virtual host.

    :) Please Rockey :)
    I know I'm asking alot and hope you will consider this task if and when you have time.

    Thanks RoboBunny. :)
     
  4. chewbacca

    chewbacca New Member

    Hello,

    i am encountering error above, but restarting the webserver doesn´t give me an error
    Code:
    tail -f /var/log/nginx/error.log
    2011/02/24 19:14:30 [error] 17889#0: *1 upstream prematurely closed connection while reading response header from upstream, client: 192.168.200.206, server: mail.example.de, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "192.168.xxx.xxx"
    2011/02/24 19:14:30 [error] 17889#0: *1 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "192.168.200.19"
    2011/02/24 19:14:30 [error] 17889#0: *1 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "192.168.200.19"
    2011/02/24 19:14:33 [error] 17889#0: *1 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "192.168.200.19"
    2011/02/24 19:19:25 [error] 17889#0: *4 upstream prematurely closed connection while reading response header from upstream, client: 192.168.200.206, server: mail.example.de, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "server"
    2011/02/24 19:19:25 [error] 17889#0: *4 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "server"
    2011/02/24 19:19:25 [error] 17889#0: *4 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "server"
    2011/02/24 19:19:28 [error] 17889#0: *4 open() "/usr/share/pyshared/baruwa/favicon.ico" failed (2: No such file or directory), client: 192.168.200.206, server: mail.example.de, request: "GET /favicon.ico HTTP/1.1", host: "server"
    2011/02/24 19:20:32 [error] 17889#0: *4 upstream prematurely closed connection while reading response header from upstream, client: 192.168.200.206, server: example.de, request: "GET /accounts/login/?next=/ HTTP/1.1", upstream: "uwsgi://unix:///var/run/uwsgi/uwsgi-python2.6/baruwa/baruwa.sock:", host: "server"
    
    
    Code:
    /etc/init.d/uwsgi-python2.6 restart && /etc/init.d/nginx restart
     * Restarting WSGI server(s) uwsgi-python2.6                                                                                                          [ OK ]
    Restarting nginx: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    nginx.
    
     
    Last edited: Feb 24, 2011
  5. Rocky

    Rocky New Member

    Hi,

    Is this a fresh install or upgrade? Make sure /usr/share/pyshared/baruwa/settings.py contains the correct db login infomation.
     
  6. chewbacca

    chewbacca New Member

    Hello,

    trhis is a fresh install i tested the baruwa mysql password with

    Code:
    mysql -u baruwa -p 
    and it matched the pw in the settings.py
     
  7. chewbacca

    chewbacca New Member

    Hello,

    i got it working after i dropped the baruwa database and recreated it.
     
  8. Rocky

    Rocky New Member

    Great! Must have been a screwy db install.
     

Share This Page