Rewrite

將虛擬域與 WordPress 和 Cherokee Web 伺服器一起使用

  • February 18, 2015

我正在嘗試將 WordPress 配置為與 Cherokee Web Server 一起使用。WordPress 中設置的多站點是yyy.com並使用“子域”。因此,我有類似的網站aaa.yyy.combbb.yyy.com- 到目前為止它們都執行良好。

但是,我有另一個完全不同的域:abcde.com. 在 WordPress 中,子域設置是abcde.yyy.com. 公共使用者訪問abcde.com時,無法正確重定向到 WordPress 子域abcde.yyy.com

如何設置 Cherokee 以將虛擬域正確重定向到 WordPress?這意味著,面向公眾的域將是abcde.com但 WordPress 希望看到abcde.yyy.com正確返回特定站點的正確內容。

(我試過了,它總是被重定向到這樣的東西:“ http://yyy.com/wp-signup.php?new=abcde.com ”)

首先,設置您的 DNS 以正確指向子域和映射域。

然後,在切羅基…

Create a Source (under Sources)
Type: Remote Host
Nickname: Cherokee
Connection: [the ip and port which can reach Cherokee Web Server]

在 WordPress 中..(您需要先啟用多站點)。

Create the WordPress Site
My Sites -> Sites -> (Add New)
add the site...

Then, go to -> My Sites -> Network Admin -> Sites -> (select site)
in Settings, change only these 2 fields:
Home: http://abcde.com
Fileupload Url: http://abcde.com

然後,回到切羅基…

Create a new Virtual Server and assign it to your sub-domain, eg. "abcde.yyy.com"
This is a PHP Virtual Server, so follow the instructions from Cherokee Help Manual,
and test it to make you can get WordPress running. 
References:
http://www.cherokee-project.com/doc/cookbook_php.html
http://www.cherokee-project.com/doc/cookbook_wordpress.html

現在,您可以回到 WordPress ……

Go to site... configure, etc.
(set permalinks properly, etc.)

最後,回到切羅基…

Create yet another another Virtual Server - this time a HTTP Reverse Proxy server for your mapped domain name
Nick: abcde.com
Document Root: path to WordPress directory

... in Basics
Directory Indexes - empty

... in Rule Management
remove all except Default
change Handler to HTTP Reverse Proxy, 
 Request -> URL Rewriting
  Add RegEx: ^/(.*)$
  Substition: http://abcde.yyy.com/$1
  ... click Add
Back-end Servers 
 Balancer -> Round Robin
Assign Information Sources
 Application Server -> "Cherokee" (as an Information Sources)

最後,重啟切諾基!就是這樣!

引用自:https://serverfault.com/questions/441879