Open mawint opened 2 years ago
This sounds reasonable and Wordpress is a very common use case. I know our Nginx config is behind our HTTPD config in terms of things "just working", although that's primarily due to .htaccess
files with HTTPD. It would still be nice if we could make things like pretty URLs generally work out of the box.
I'm wondering if we should gate this behind a configuration setting though? If so, thoughts as far as default on or default off?
I don't know off-hand how many different PHP frameworks this would work for and if it's present, you can't easily turn it off. If the try_files ...
line was behind a config setting, then users could disable that and add their own snippet if the default one doesn't work. I think that would be my preference.
That could work as well.
This is more of an "enhancement" topic so I think exploring options to make it universal to most applications would be ideal. Providing my use case though I currently added an additional *-server.conf
file because I knew I needed to in order to enable clean URLs but I'm not sure everyone will know to do that.
But I do think that if a location /
block is added to the default config, having the ability to adjust what's under root will be needed. So you could have an option to turn on/off the default try_files ...
line and fallback on them providing their own plus any additional subfolder location blocks/rewrites they needed under root.
Thoughts on adding a
location /
directives in the default nginx config? I'm not sure how many php applications can use this universally but I had to add one with a*-server.conf
file to enable clean urls for Wordpress. We could even make it more dynamic to allow editing of the block.Example
The
*-location
is placeholder and could be named anything but this location directive turns on clean urls by default and allows users to add additional conf files to add rewrites, additional location directives under the root location, etc.Of course the
try_files
portion is only applicable if it can be used universally for all php projects. I know laravel uses a similartry_files
to enable clean urls as well.