我已经安装了Bitnami Mutli层Wordpress堆栈(在Azure上)。
我想在该堆栈上安装一些WP的其他实例。因为它是堆栈的多层版本,所以安装其他WP实例的常规说明不起作用。这是因为MySQL服务器位于一个单独的VM上,并且没有设置安装的Bitnami Wordpress来处理它。
因此,诸如posted here之类的指令不起作用。官方说明是here。{/ p>
因此,我希望从人们那里听到的是向该堆栈添加其他WP实例的推荐方法。例如,我可以继续以正常方式安装wordpress(在其中设置包含WP源文件的新目录),然后对Apache和/或vhost conf文件进行一些手动更改,以便新实例是在服务器上注册?如果是这样,我需要对conf文件(等)进行哪些更改?
请注意,我不指的是Bitnami Wordpress 多站点堆栈。它是多层堆栈,MySQL服务器位于单独的VM上。另外,由于各种原因,我对使用Wordpress的多站点功能不感兴趣。
答案 0 :(得分:0)
[Bitnami Developer here]正如您所提到的,在使用Multi-Tier解决方案时,您无法按照官方工作流程在同一堆栈上安装多个WordPress。
Bitnami还没有开发出类似的方法来在Multi-Tier解决方案上安装多个WP。但是,我可以逐步描述您需要做什么才能达到目的。
复制WordPress文件夹。您可以使用以下命令:
sudo cp -rf /opt/bitnami/wordpress /opt/bitnami/second-wordpress
sudo cp -rf /bitnami/wordpress/ /bitnami/second-wordpress/
sudo rm /opt/bitnami/second-wordpress/wp-config.php
sudo rm /opt/bitnami/second-wordpress/wp-content
sudo ln -s /bitnami/second-wordpress/wp-config.php /opt/bitnami/second-wordpress/wp-config.php
sudo ln -s /bitnami/second-wordpress/wp-content /opt/bitnami/second-wordpress/wp-content
sudo chown -R root:daemon /opt/bitnami/second-wordpress/
sudo chown -R root:daemon /bitnami/second-wordpress/
配置Apache。此步骤取决于您需要的Apache配置。我想你想在http://YOUR-SERVER-IP/first-wordpress有两个WP,第二个在http://YOUR-SERVER-IP/second-wordpres。
Fist,准备Apache使用“前缀配置”。
sudo mkdir /opt/bitnami/apache/conf/prefix
sudo mv /opt/bitnami/apache/conf/vhosts/htaccess /opt/bitnami/apache/conf/prefix/htaccess
sudo cp /opt/bitnami/apache/conf/prefix/htaccess/wordpress-htaccess.conf /opt/bitnami/apache/conf/prefix/htaccess/second-wordpress-htaccess.conf
sudo rm /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
sudo rm /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
使用以下内容创建文件/opt/bitnami/apache/conf/prefix/wordpress-prefix.conf
:
Alias /first-wordpress/ "/opt/bitnami/wordpress/"
Alias /first-wordpress "/opt/bitnami/wordpress"
<Directory "/opt/bitnami/wordpress">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
DirectoryIndex index.html index.php
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</Directory>
Include /opt/bitnami/apache/conf/prefix/htaccess/wordpress-htaccess.conf
使用以下内容创建文件/opt/bitnami/apache/conf/prefix/second-wordpress-prefix.conf
:
Alias /second-wordpress/ "/opt/bitnami/second-wordpress/"
Alias /second-wordpress "/opt/bitnami/second-wordpress"
<Directory "/opt/bitnami/second-wordpress">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
DirectoryIndex index.html index.php
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [S=1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</Directory>
Include /opt/bitnami/apache/conf/prefix/htaccess/second-wordpress-htaccess.conf
修改文件/opt/bitnami/apache/conf/prefix/htaccess/second-wordpress-htaccess.conf
中的以下行:
<Directory "/opt/bitnami/wordpress/wp-content/plugins/akismet">
值为:
<Directory "/opt/bitnami/second-wordpress/wp-content/plugins/akismet">
在文件/opt/bitnami/apache/conf/bitnami/bitnami.conf
中添加以下行(ErrorDocument 503 /503.html
后面的所有Vhosts):
Include "/opt/bitnami/apache/conf/prefix/wordpress-prefix.conf"
Include "/opt/bitnami/apache/conf/prefix/second-wordpress-prefix.conf"
连接数据库
sudo /opt/bitnami/mysql/bin/mysql -u root -h mariadb -p
为新WP创建数据库并向bn_wordpress
用户授予权限。
CREATE DATABASE bitnami_second_wordpress;
GRANT ALL PRIVILEGES ON `bitnami_second_wordpress`.* TO 'bn_wordpress'@'%'
在/opt/bitnami/wordpress/wp-config.php
编辑以下行:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
值为:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/first-wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/first-wordpress');
在/opt/bitnami/second-wordpress/wp-config.php
编辑以下行:
define('DB_NAME', 'bitnami_wordpress');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
值为:
define('DB_NAME', 'bitnami_second_wordpress');
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/second-wordpress');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/second-wordpress');
最后重启Apache;
sudo nami restart apache