I use bundle Nginx + Gunicorn + Pserve (Pyramid) on my web server to run 
several sites. To be exact only two sites now working. If I put it right 
*Nginx* listens *80* port and proxying requests to Gunicorn on 5000 and 
5010 ports, here is my nginx configs for two domains:

# $ cat cat /etc/nginx/sites-available/domain1.ru
upstream domain1.ru {
    server 0.0.0.0:5000;
    server 0.0.0.0:5001;
}

server {
    listen 80;
    server_name www.domain1.ru domain1.ru;
    error_log  /var/log/nginx/domain1.ru.error.log;
    access_log  /var/log/nginx/domain1.ru.access.log;

    location / {
        try_files $uri @proxy_to_app;
    }

    location @proxy_to_app {
        proxy_set_header        Host $http_host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;

        client_max_body_size    10m;
        client_body_buffer_size 128k;
        proxy_connect_timeout   60s;
        proxy_send_timeout      90s;
        proxy_read_timeout      90s;
        proxy_buffering         off;
        proxy_temp_file_write_size 64k;
        proxy_pass      http://127.0.0.1:5000;
        proxy_redirect          off;
    }
}


# $ cat cat /etc/nginx/sites-available/domain2.ru
upstream domain2.ru {
    server 0.0.0.0:5010;
    server 0.0.0.0:5011;
}

server {
    listen 80;
    server_name www.domain2.ru domain2.ru;
    error_log  /var/log/nginx/domain2.ru.error.log;
    access_log  /var/log/nginx/domain2.ru.access.log;

    location / {
        try_files $uri @proxy_to_app;
    }

    location @proxy_to_app {
        proxy_set_header        Host $http_host;
        proxy_set_header        X-Real-IP $remote_addr;
        proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header        X-Forwarded-Proto $scheme;

        client_max_body_size    10m;
        client_body_buffer_size 128k;
        proxy_connect_timeout   60s;
        proxy_send_timeout      90s;
        proxy_read_timeout      90s;
        proxy_buffering         off;
        proxy_temp_file_write_size 64k;
        proxy_pass      http://127.0.0.1:5010;
        proxy_redirect          off;
    }
}

And these two sites works well, but when I added just the same config except 
changing ports to 5015 and 5016 something went wrong. When I just started 
*pserve* process I got an error:

$ pserve production.ini --reload --log-file=domain3.ru-pserve.log
Starting subprocess with file monitor
Traceback (most recent call last):
  File "/var/www/eba/data/gs/env/bin/pserve", line 9, in <module>
    load_entry_point('pyramid==1.4.5', 'console_scripts', 'pserve')()
  File "/var/www/eba/data/gs/env/lib/python2.7/site-packages/pkg_resources.py", 
line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/var/www/eba/data/gs/env/lib/python2.7/site-packages/pkg_resources.py", 
line 2566, in load_entry_point
    return ep.load()
  File "/var/www/eba/data/gs/env/lib/python2.7/site-packages/pkg_resources.py", 
line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File 
"/var/www/eba/data/gs/env/lib/python2.7/site-packages/pyramid/scripts/pserve.py",
 line 28, in <module>
    from pyramid.compat import WIN
  File 
"/var/www/eba/data/gs/env/lib/python2.7/site-packages/pyramid/compat.py", line 
114, in <module>
    from urllib2 import urlopen as url_open
  File "/var/www/eba/data/gs/env/opt/Python-2.7.3/lib/python2.7/urllib2.py", 
line 94, in <module>
    import httplib
  File "/var/www/eba/data/gs/env/opt/Python-2.7.3/lib/python2.7/httplib.py", 
line 69, in <module>
    from array import array
ImportError: /var/www/eba/data/gs/env/lib/python2.7/lib-dynload/array.so: 
cannot open shared object file: Too many open files in system


When I run pserve again I got another error, here is just last several lines:

File 
"/var/www/eba/data/gs/env/lib/python2.7/site-packages/paste/deploy/loadwsgi.py",
 line 3, in <module>
    from __future__ import with_statement
ImportError: No module named __future__

And many different errors like: No module named __random__, No module named _io 
etc. 

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to