Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
    location /(0-9)* {

            #rewrite  ^/(0-9)*$  /disp\.cgi?$1 last;
            rewrite  ^(.*)$  /disp\.cgi?$1  break;
            #include proxy.conf;

            proxy_pass  http://127.0.0.1:8999;
    }

Hi I'm trying to rewrite (0-9)* and pass it to thttpd. But all I get is a 404 error: If i Enter http://example.com/123 I get URL '/123' was not found on thttpd Any suggestions? thanks!

share|improve this question

1 Answer 1

the following syntax should work

location  / {

            rewrite  ^/([0-9]*)$  /disp.cgi?$1  break;
            #include proxy.conf;

            proxy_pass  http://127.0.0.1:8999;
    }

If / should ne rewritten to another URL add this as well:

location = / {

            proxy_pass  http://127.0.0.1:8999/;
    }
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.