简体   繁体   English

如何为WordPress多站点编写H2O Web服务器Mruby处理程序?

[英]How do I write h2o webserver mruby handlers for WordPress multisite?

This is what Apache needs. 这就是Apache所需要的。 I like to know how I do this in h2o. 我想知道如何在水中进行此操作。

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]

// wasted 300 reputation on this btw. //在此btw上浪费了300点声望。

Basically, your Apache file is a bit too much for WordPress. 基本上,对于WordPress,您的Apache文件有点过多。

This should do the trick on H2O: 这应该可以解决H2O的问题:

hosts:
  "www.example.com":
    listen:
      port: 80
    paths:
      "/":
        file.dir: /path/to/doc-root   # serve static files if found
        redirect:                     # if not found, internally redirect to /index.php/<path>
          url: /index.php/
          internal: YES
          status: 307

file.custom-handler:                  # handle PHP scripts using php-cgi (FastCGI mode)
  extension: .php
  fastcgi.spawn: "PHP_FCGI_CHILDREN=10 exec /usr/bin/php-cgi"

access-log: /path/to/the/access-log
error-log: /path/to/the/error-log
pid-file: /path/to/the/pid-file
http2-reprioritize-blocking-assets: ON   # performance tuning option

Hope this helps... 希望这可以帮助...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM