Problem:

http://127.0.0.1/  --> "Hello, world!" works perfect
http://127.0.0.1/add       --> "not found"


app:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import web
web.config.debug = True


urls = (
    '/', 'index',
    '/add', 'add'
)

class index:
    def GET(self):
        return "Hello, world!"    


class add:
    def GET(self):
        return 'ADD!!'

app = web.application(urls, globals())

if __name__ == "__main__":
    web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
    app.run()

nginx config:

server {
        #listen   80; ## listen for ipv4; this line is default and implied
        #listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

        root /usr/share/nginx/www;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
        fastcgi_param REMOTE_ADDR $remote_addr;
        fastcgi_param REMOTE_PORT $remote_port;
        fastcgi_param SERVER_ADDR $server_addr;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9002;


        }

        location /doc/ {
                alias /usr/share/doc/;
                autoindex on;
                allow 127.0.0.1;
                allow ::1;
                deny all;
        }


        location /static/ {
                root /path/to/www;
                if (-f $request_filename) {
                rewrite ^/static/(.*)$  /static/$1 break;
        }
    }

nginx logs:

127.0.0.1 - - [19/Jan/2016:14:11:09 +0100] "GET /add HTTP/1.1" 404 40 "-" 
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/40.0.2214.94 Safari/537.36"
127.0.0.1 - - [19/Jan/2016:14:11:11 +0100] "GET /add?x=1 HTTP/1.1" 404 40 
"-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/40.0.2214.94 Safari/537.36"
127.0.0.1 - - [19/Jan/2016:14:11:28 +0100] "-" 400 0 "-" "-"
127.0.0.1 - - [19/Jan/2016:14:17:54 +0100] "GET / HTTP/1.1" 200 23 "-" 
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) 
Chrome/40.0.2214.94 Safari/537.36"


-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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 https://groups.google.com/group/webpy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to