mpfr / httpd-plus

Add-ons for the OpenBSD web server
ISC License
37 stars 3 forks source link

Missing WordPress Example section #4

Closed atanas-vladimirov closed 7 months ago

atanas-vladimirov commented 7 months ago

Hi,

Thanks for your great work!

I just want to stop by and tell you that the link for -current https://mpfr.net/man/httpd-plus/current/httpd.conf.5.html#EXAMPLES is missing the WordPress examples. It is there if you choose any of the -stable releases.

I'm not sure if this is intended or not :)

Another think that I want to share is that the fastcgi script in

    location not found "/*" {
        fastcgi {
            socket "/run/php-fpm.sock"
            script "/index.php"
        }
    }

should be replaced with fastcgi param SCRIPT_FILENAME .... JFTR, I'm running -current.

Once again, thanks for your work on making httpd better and better :)

mpfr commented 7 months ago

Thanks for reporting!

Don't know what went wrong when I was rendering the -current manpage. Anyway, should be fine now.

Will evaluate the fastcgi param SCRIPT_FILENAME ... thing later...

mpfr commented 7 months ago

If I replace fastcgi script "/index.php" by fastcgi param SCRIPT_FILENAME index.php as requested, I get a 404 File not found from fastcgi. I was testing this on 7.4-stable, though. Let me know if things recently changed in -current.

As far as I remember this was also the reason why I was digging deeper and ended up with 02-fastcgi-script-overrides which did the trick for me. A side benefit of the patch is that the full path of the script to be executed may be specified, which is, as far as I know, not possible via the SCRIPT_FILENAME CGI parameter.

atanas-vladimirov commented 7 months ago

Hi,

Maybe I didn't explained it well in the first place.

I'm using OpenBSD-current with the stock httpd and my goal is to replace the NginX for a few WordPress sites. I found that your location-asses-tests were imported upstream and decided to give it a try.

First thing I noticed was the missing example which I reported and you fixed. Thanks!

Then, I found that your example is not working with stock httpd, because there is no fastcgi script option and I get /etc/httpd.conf:39: syntax error when reloading httpd

     36         location not found "/*" {
     37                 fastcgi {
     38                         socket "/run/php-fpm.sock"
     39                         script "/index.php"                     
     40 #                       param SCRIPT_FILENAME "/subsites/wp/index.php"
     41                 }

Replacing the script "/index.php" with param SCRIPT_FILENAME "/subsites/wp/index.php" works fine. You can test it on http://wp.bsdbg.net. This is just a test WP instance.

So, I didn't test your httpd-plus patches and maybe this is my mistake. If the fastcgi script is a valid and comes from your patches, then I think that nothing should be changed.

If someone needs a WP example for "stock" httpd, he can easily adapt the one from here.

Best wishes, Atanas

mpfr commented 7 months ago

OK, now I got it. And yes, the site https://mpfr.net/man/httpd-plus/current/httpd.conf.5.html is related to my httpd-plus add-ons and the examples would not work on the stock httpd.

Thanks for clarifying!