p...@mostlybsd.com (Paul Pace), 2024.11.25 (Mon) 14:24 (CET):
> I have been working on getting pretty permalinks[1] to work properly in
> httpd. The WordPress project publishes configurations for Apache and
> nginx.[2]
> 
> I have a slightly better but still very weak grasp of nginx, so here is the
> key part of nginx.conf, as I understand it, for supporting pretty
> permalinks:
> 
> location / {
>     # This is cool because no php is touched for static content.
>     # include the "?$args" part so non-default permalinks doesn't break when
> using query string
>     try_files $uri $uri/ /index.php?$args;
> }
> 
> My attempt to match nginx functionality in httpd.conf:

These is my once working configuration. I have moved the site somewhere
else a year ago, so most of my memories are gone. No questions answered,
just something for you to play with:

        location match "/wp%-.+/.*%.txt" { block }
        location match "/wp%-.+/.*%.md" { block }
        location match "/wp-config.php" { block }
        location match "/xmlrpc.php" { block }
        location "*.png" { pass }
        location "*.jpg" { pass }
        location "*.jpeg" { pass }
        location "*.gif" { pass }
        location "*.php" {
                fastcgi socket "/run/php-fpm.sock"
        }
        location match "/(wp%-json/.*)$" {
                request rewrite "/index.php/%1"
                fastcgi socket "/run/php-fpm.sock"
                pass
        }
        location match "/wp%-admin/admin%-ajax.php" {
                fastcgi socket "/run/php-fpm.sock"
                pass
        }
        location match "/wp%-cron.php" {
                fastcgi socket "/run/php-fpm.sock"
                pass
        }
        location match "/(wp%-.+).*/?" {
                pass
        }
        location match "^/(.+)$" {
                request rewrite "/index.php/%1"
                fastcgi socket "/run/php-fpm.sock"
        }

Marcus

Reply via email to