Hi, it's not FastCGI setup. It uses web.py server:
########### run.sh
#!/bin/sh
python /home/lukasz/Praca/webpy/code.py 8080 &
python /home/lukasz/Praca/webpy/code.py 8081 &
python /home/lukasz/Praca/webpy/code.py 8082 &
python /home/lukasz/Praca/webpy/code.py 8083 &
########### code.py:
import sys
sys.stderr = None
########### /etc/nginx/sites-available/webpy
upstream backend {
server 127.0.0.1:8080 weight=3;
server 127.0.0.1:8081;
server 127.0.0.1:8082;
server 127.0.0.1:8083;
}
server {
listen 80;
server_name webpy;
# static files
location /static {
root /home/lukasz/Praca/webpy;
}
# main app configuration
location / {
root /home/lukasz/Praca/webpy;
proxy_pass http://backend;
# fastcgi_pass 127.0.0.1:8080;
# fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
# fastcgi_param PATH_INFO $fastcgi_script_name;
# fastcgi_param QUERY_STRING $query_string;
# fastcgi_param CONTENT_TYPE $content_type;
# fastcgi_param CONTENT_LENGTH $content_length;
# fastcgi_param REQUEST_METHOD $request_method;
# fastcgi_param REMOTE_ADDR $remote_addr;
# fastcgi_param REMOTE_PORT $remote_port;
# fastcgi_param SERVER_PROTOCOL $server_protocol;
# fastcgi_param SERVER_ADDR $server_addr;
# fastcgi_param SERVER_PORT $server_port;
# fastcgi_param SERVER_NAME $server_name;
}
}
Could somebody review this config?
On 23 Lis, 21:48, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> hi lukaszt
> thanks for the configs file.. i got it working.. but how do i specify more
> than one fastcgi server for load balancing?
> thanks
>
> On Nov 19, 2007 7:59 AM, lukaszt <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi,
> > sorry I was offline for last couple of days
>
> > Green:
> > here are config files:
> >http://luke.jottit.com/webpy_%2B_nginx
>
> > rkmr.em:
> > i'll try to run webpy with loadbalancer this week and let you know
>
> > On 17 Lis, 14:02, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > > lukasz,
> > > can you give the complete nginx configuration file?
>
> > > On Sep 20, 2007 1:00 AM, lukaszt <[EMAIL PROTECTED]> wrote:
>
> > > > I've got nginx+spawn-fcgi+web.py on Ubuntu Feisty working.
> > > > Can somebody review this config please?
>
> > > > MySQL:
> > > > sudo apt-get install mysql-server-5.0 libmysqlclient15-dev
>
> > > > Python/web.py:
> > > > sudo apt-get install python-dev python-setuptools
> > > > sudo easy_install web.py Mako MySQL-python python-cjson
>
> > > > Nginx:
> > > > sudo apt-get install nginx
>
> > > > spawn-fcgi:
> > > > wgethttp://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2
> > > > tar -xvjf lighttpd-1.4.18.tar.bz2
> > > > cd lighttpd-1.4.18
> > > > make
> > > > cp src/spawn-fcgi /usr/bin/spawn-fcgi
>
> > > > ---
>
> > > > Files:
>
> > > > I've created run.sh file inside project dir to run fcgi app:
>
> > > > run.sh
> > > > <code>
> > > > #!/bin/sh
> > > > /usr/bin/spawn-fcgi -f <PATH_TO_MAIN_SOURCE_FILE> -a 127.0.0.1 -p 8081
> > > > </code>
>
> > > > Path to this file is also appended to /etc/rc.local
>
> > > > Part of /etc/nginx/nginx.conf inside http section:
> > > > <code>
> > > > server {
> > > > listen 80;
> > > > server_name something.local;
> > > > location / {
> > > > fastcgi_pass 127.0.0.1:8081;
> > > > include /etc/nginx/fastcgi_params;
> > > > root <PATH_TO_ROOT_PROJECT_LOCATION>;
> > > > fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; # [1]
> > > > fastcgi_param PATH_INFO $fastcgi_script_name; # [2]
> > > > }
> > > > }
> > > > </code>
>
> > > > Part of /etc/hosts:
> > > > <code>
> > > > 127.0.0.1 something.local
> > > > </code>
>
> > > > main.py:
> > > > <code>
> > > > #!/usr/bin/env python
> > > > # -*- coding: utf-8 -*-
>
> > > > import web
>
> > > > urls = (
> > > > r"^/(.*)$", "index",
> > > > )
>
> > > > class index:
> > > > def GET(self, *args):
> > > > print args
>
> > > > web.webapi.internalerror = web.debugerror
>
> > > > if __name__ == "__main__":
> > > > web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func,
> > > > addr)
> > > > web.run(urls, globals(), web.reloader)
> > > > </code>
>
> > > > ---
>
> > > > [1] is modified line from nginx wiki
> > > > [2] after adding this line web.py sterted to work
>
> > > > Now I'm not sure if it's configured properly. Everything seems to work
> > > > ok.
> > > > Is [1] and [2] inside /etc/nginx/nginx.conf done right?
> > > > Thanks for help.
>
> > > > Regards
> > > > Ćukasz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---