Tag Info

New answers tagged

0

Looking at this sample config file from a GitHub mirror of the open source repo for OpenLiteSpeed it seems like the config would be something like this: context { uri /hideme/ accessControl { deny } location hideme/ }


0

Change passenger_base_uri /; to passenger_base_uri /portal;. From the official documentation : 8.2.2. passenger_base_uri Used to specify that the given URI is a distinct application that should be served by Phusion Passenger.


0

If you have access to modify your vhosts then you might find it cleanest to do it there. The vhost that's listening on port 80 should just do a single rewrite rule that would redirect everything immediately to https: <Virtualhost website.com:80> .... RewriteEngine on RewriteRule ^(.*)$ https://website.com$1 [R=301,L] </Virtualhost> ...


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;


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; [ ... ] }


0

From what I see you can just left index index.php throughout the whole server {} block and remove any /app/ locations. You don't need to rewrite anything to index.php.


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.


0

OK, so firstly I think you should consider carefully whether nginx will really help you with your performance problem (per your comment), and test that in a development environment before worrying about how your deployment will work. It is true that nginx is faster, and that it's multi-threaded architecture helps deal with high loads, but yours would be an ...


0

You can use a custom rewrite provider: http://www.iis.net/learn/extensions/url-rewrite-module/developing-a-custom-rewrite-provider-for-url-rewrite-module A provider is a C# code, which turns one string into another string. You can then use it in a similar way how you'd use rewrite map: You can pick a separator, which is not valid in a url at all (maybe ...


0

Why are you redirecting to the same vhost with a proxy_pass directive ?! Also, nginx elects the matching location a way you probably don't expect. Read this : Nginx rewite rules 403 error. It's better not to use if when it's possible to avoid it. server { listen 80; server_name saas.localhost www.saas.localhost staging.saas.localhost; root ...


0

The root cause is with the MultiViews directive http://httpd.apache.org/docs/2.4/mod/mod_negotiation.html#multiviews If the server receives a request for /some/dir/foo and /some/dir/foo does not exist, then the server reads the directory looking for all files named foo.*, and effectively fakes up a type map which names all those files, assigning ...


0

You can use direct argument check: if ($arg_mode = "logout") { rewrite ^/bb/ucp\.php http://$server_name/dp/user/logout redirect; } But your approach seems to be legit as well except a wrong regexp. You have a $ sign at the end meaning the end of a line while in your example you have $server_name/bb/ucp.php?mode=logout&sid=xxxxx where logout is ...


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 ...


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 ...


0

Displaying a similar looking file or directory instead of generating a 404 file-not-found error when a non-existent URL is used is non-default behaviour. It may be the result from enabling apache's mod_speling but more likely is that you have rewrite rules in a .htaccess file. By default a Drupal 7 deployment includes this .htaccess file which does not ...


0

The answer for this specific question: #gateway.school.edu virtual host RewriteCond %{REMOTE_ADDR} ^10\.(.*)$ [OR] RewriteCond %{REMOTE_ADDR} ^172\.(.*)$ [OR] RewriteCond %{REMOTE_ADDR} ^192\.(.*)$ RewriteRule .* reset.school.edu [R=301,L]


0

You forgot the regex operator : ~. location ~ ^/\d+/\d+/([-\w]+)\.html$ { return 301 /$1.html; }


0

Take it out of the location block, then this should work: rewrite ^/\d+/\d+/([^/]+\.html)$ /$1 permanent;


0

You'll need to install the URL Rewrite module for IIS. Then you can write a rule that will rewrite yourwebsite.com/home/ to yourwebsite.com/tabular/ The rule will be stored in the web.config for the application. This example would rewrite all URLs under /home/ to /tabular/ <rule name="Rewrite home to tabular"> <match url="^/home/(.*)" /> ...


1

Changing the rule to RedirectRule ^/arf/sites/(.*)$ /docs/saf/files$1 [R=301,I,L] should solve the problem.


0

An idea how you could implement this: So you need to setup: a Varnish reverse proxy listening on port *:80 and using the backend localhost:8080 a Nginx webserver listening on port *:443 and forwarding to localhost:80 listening on port localhost:8080 and serving a web site Actually Nginx can already be configured as a caching reverse proxy. However ...


3

You have misunderstood the $request_filename variable. It represents the physical path mapped to the file considering root and alias directives values and the current URI being processed. So your error_page directive will internally redirect to a URI corresponding to a physical path that doesn't exist as it the same as the path tested to enter your if ...


1

I think error_page 404 = $request_filename; should be error_page 404 $request_filename; according to ngx_http_core_module documentation If your file doesn't exists, it should return the default 404 and not a 200. Just tell nginx to return this file for all 404 errors. This code should be placed above your conditional and in your location block: ...


1

Varnish identifies different entities by their req.url and their req.http.Host (if present, otherwise, it uses server.ip). What you want is this: sub vcl_hash { #Example URL is: # http://varnish:8101/VirtualHostBase/http/example.com:80/path/VirtualHostRoot/ #req.url contains only: # /VirtualHostBase/http/example.com:80/path/VirtualHostRoot/ ...


0

We have several clients that have it set up so they retain control over their own DNS, as some of them only have subdomains that point at us. We are using nginx as a load balancer that also handles redirects, and we have our redirects in the default vhost file (00default). Nothing too complex, it works quite well for us: if ($host ~* "^ourdomain.com$") { ...


1

Don't use a location for this at all. It doesn't match on query string arguments. Instead, just check the argument and request URI directly. For example: location / { if ($arg_action = "lostpassword") { rewrite /wp-login.php http://recover.geo.com/wp-login.php?action=lostpassword permanent; } # everything else... }


1

You missed the ~ operator before location regex, so it's not processed as a regular expression but as a pefixed location. By the way rewrite don't accept 302 flag. Use redirect flag.



Top 50 recent answers are included