Rewrite non-ssl to ssl except for given location

Jonathan Matthews contact at jpluscplusm.com
Sun Apr 15 15:42:54 UTC 2012


On 15 April 2012 16:32, Adnan RIHAN <adnan at rihan.fr> wrote:
> location / {
> return 301 https://$host$request_uri;
> }
> location = /includes/api.php {
> ...
> }
>
> The problem is that I'm on a web hosting service which allow s customers to
> edit an included config file.
>  So, "location /" is a duplicate :/
>
> Isn't there a way to write "location [not matching] /includes/api.php {}" ?

The method mentioned above *is* the canonical way to do that. It's in
the docs somewhere.

Anything else will be a hack of some kind, strongly influenced by your
specific nginx setup.  You'll need to give more complete information
about the nuances of the shared hosting setup in order for someone to
work out if there's a way to achieve what you want to.

> ---
> Cordialement, Adnan RIHAN.
> Président-Fondateur de l'association (de loi 1901) Virtual-Info, hébergeur

You have the wrong signature separator here. It's not "---"
(dash-dash-dash), it's "-- " (dash-dash-space).

Jonathan
-- 
Jonathan Matthews
Oxford, London, UK
http://www.jpluscplusm.com/contact.html



More information about the nginx mailing list