S
S
Sergey Fedotov2012-02-22 10:22:11
Nginx
Sergey Fedotov, 2012-02-22 10:22:11

[SOLVED] nginx url.rewrite-once analog

The other day I decided to try replacing lighttpd with nginx. However, I can’t overcome the construction of the form (lighttpd.conf): The script is not mine - wiki.openstreetmap.org/wiki/Microcosm . Used to store "secret" data from JOSM. All that I managed - when I enter the server/api/ address, I am transferred to server/m/microcosm.php
url.rewrite-once = ( "^/api/(.*)$" => "/m/microcosm.php/$1" )

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
avalak, 2012-02-22
@avalak

In general it will be something like this. Microcosm did not use it, you probably have to finish the configuration a little.

    ## Microcosm
    location /api/
    #location ~ ^/api/(.*)
    {
        ## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        fastcgi_pass php_backend; # указать upstream
        
        root /path/to/microcosm/m/; # каталог с microcosm.php или прописать $document_root
        fastcgi_index microcosm.php;

        include fastcgi_params;
        #fastcgi_param QUERY_STRING $query_string;
        #fastcgi_param REQUEST_URI $1;
        fastcgi_param SCRIPT_FILENAME $document_root/microcosm.php;
    }

I
Ivan, 2012-02-22
@iSage

rewrite ^/api/(.*)$ /m/microcosm.php/$1 break;
or
rewrite ^/api/(.*)$ /m/microcosm.php/$1 last;
if after that you need to process other locations (for example, a single location that catches *.php).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question