A
A
Alexey Kalinin2014-11-05 00:43:40
PHP
Alexey Kalinin, 2014-11-05 00:43:40

How to handle missing location in nginx?

There is a script for shortening url into one file, for example s.php There are many locations in nginx: /photo/ /author/ ... .... s.php file?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Kalinin, 2014-11-05
@Kaliha

The problem was solved like this:

location ~* /([a-z0-9]+)$ {
rewrite ^/([a-z0-9]+)/?$ /s.php?url=$1 break;

B
Boris Benkovsky, 2014-11-05
@benbor

nginx.org/ru/docs/http/ngx_http_core_module.html#t...

N
neolink, 2014-11-05
@neolink

location (which are not regexp) are checked in the order they are defined, so you can just write

location / {
    // тут proxy_pass, fastcgi_pass и прочее
}

at the very end of the config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question