Tag Info

Hot answers tagged

3

Locations using regexs must use the operator ~ : location ~ ^/wp-(admin|login)\.php$ { return 444; } Read this part of the official documentation to understand how locations work and this other part to understand what's the processing order.


2

If you want your site to answer to these Hosts values then you have no choice, you must put them in the server_name directive (you could use wildcard or regex to make the conf shorter). server { server_name www.test.com; include /path/to/server_names; [ ... ] location / { [ ... ] fastcgi_param HTTP_HOST "www.test.com"; ...


2

If i understood you currectly you need something like this: map $http_host $name { hostnames; p.test.tst.com.local test.com; ... } ... server { ... location / { fastcgi_pass unix:/var/run/php5-fpm.sock include fastcgi_params fastcgi_param HTTP_HOST $name; } This ...


2

You were really close, but there are a couple of subtleties with S3 Routing Rules that you need to take into account: The HttpErrorCodeReturnedEquals element is one form of negative matching, but while an object that isn't present may cause a 404, it also may cause a 403. This depends on the bucket policy. You'll need to determine which is the case for ...


2

Wouldn't the error_page directive do this for you you? For example something like this: server { ... error_page 404 /404page.html; ... location = /authreq.html { if ($allowed = 0){ return 404; } } }


1

You should just check the argument value directly. if ($arg_mode = "logout") {


1

You have no location block forwarding requests for php files to a processing backend. Add a location block for php files and use nginx fastcgi_module into it, then convert rewrites to php files from break to last. You can find alot of examples on server fault : search. Update : root location block fix as asked in comments. Your regex already matches / so ...


1

The problem is that when you add the second match, to catch the filename ending, you are forgetting to attach that match to the rewrite. The first parenthesis $1, which you're adding on the rewrite side, but that one no longer contains the .gif, .jpg etc because they are outside the parenthesis. Instead, they end up in $2. So try rewriting the rules to ...


1

Yes, add an inbound rule. Set it to be: Match URL: .* to match any request path Conditions: {HTTP_HOST} Matches the pattern www2.example.org - use this section to match your other hostnames, e.g. add another {HTTP_HOST} for www3.example.org, and set the condition logical grouping to Match Any Action: Redirect Action Properties: http://www.example.org


1

This is time to use regex location blocks : location ~ /(app1|app2|app3|groupapp1(?:/(subapp1|subapp2|subapp3)))/ { try_files $uri $uri/ /$1/index.php$is_args$args; [ ... ] }


1

directive "break" will stop rewrite module working. If you using break inside location, your request will be proceed in it, so: rewrite ^/r/([^/]*)$ /s/ta/$1 break; rewrite ^/e/(.*)$ /en/ta/$1 break;



Only top voted, non community-wiki answers of a minimum length are eligible