The Wayback Machine - https://web.archive.org/web/20200814064817/https://github.com/digitalocean/nginxconfig.io/issues/112
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong order for including wordpress.conf #112

Closed
mike-sfg opened this issue Sep 16, 2019 · 1 comment
Closed

Wrong order for including wordpress.conf #112

mike-sfg opened this issue Sep 16, 2019 · 1 comment
Assignees

Comments

@mike-sfg
Copy link

@mike-sfg mike-sfg commented Sep 16, 2019

The Wordpress configuration includes the wordpress.conf file after the location rule is matched for handling .php files.

See this portion of example.com.conf:

# handle .php
location ~ \.php$ {
include nginxconfig.io/php_fastcgi.conf;
}

# additional config
include nginxconfig.io/general.conf;
include nginxconfig.io/wordpress.conf;

When the location block uses regular expressions, it will use the first matching regex expression in order of it's appearance in the configuration file. (See http://nginx.org/en/docs/http/ngx_http_core_module.html#location).

So the regex-pattern location blocks with php files in wordpress.conf will be ignored, because it has already been matched by the more general location ~ \.php$ pattern.

At least that is my understanding of the documentation. I started investigating this because I found some of these rules were being ignored on my server.

Thanks for looking into this.

@MattIPv4
Copy link
Member

@MattIPv4 MattIPv4 commented Jun 11, 2020

Thanks for the report -- my understanding of NGINX is the same, everything would match the generic .php location regex block and never make it to the WordPress-specific regex location rules below.

@MattIPv4 MattIPv4 self-assigned this Jun 11, 2020
@MattIPv4 MattIPv4 closed this in 16a860f Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.