如何删除WordPress 的“多站点”模式
WordPress 3.0+ 可以直接开启多站点模式,如果你要开启,请查看: WordPress 开启多站点(含Apache和Nginx伪静态规则) 。
今天就简单说一下,如果将关闭多站点模式,还原主站点为单站点(主站点即你开启多站点模式前的默认站点)。开始之前,你要备份整个数据库和所有文件,然后想办法将主站点以外的所有站点的恢复到其他地方,或者分别转到单站点模式。
在这里暂时不介绍这个步骤,但是你一定要自己做好!!建议先阅读 WordPress 开启多站点(含Apache和Nginx伪静态规则),因为很多步骤都是反过来的。1、禁用所有插件,删除主站点以外的所有站点(记得备份或迁移这些站点,删除操作将会删除相关的数据)2、删除之前添加到 wp-config.php 用来开启多站点的配置代码(类似以下代码:)。
lnmp如何搭建多站点
在/usr/local/nginx/conf/vhost/ 这个目录下新建文件 你的域名.conf
文件内容如下:
server
{
listen 80;
#listen [::]:80;
server_name 你的域名;
index index.html index.htm index.php default.html default.htm default.php;
root /www/web/web1; 这里是你站点的根目录
include hlkan.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
然后执行 /root/lnmp reload 就好了
要创建多个的话重复操作就好了。
如何在Nginx服务器中设置多个站点
这里以配置2个站点(2个域名)为例,n 个站点可以相应增加调整,假设:IP地址: *.*.*.*域名1 example1.com 放在 /www/example1域名2 example2.com 放在 /www/example2配置 nginx virtual hosting 的基本思路和步骤如下:把2个站点 example1.com, example2.com 放到 nginx 可以访问的目录 /www/给每个站点分别创建一个 nginx 配置文件 example1.com.conf,example2.com.conf, 并把配置文件放到 /etc/nginx/vhosts/然后在 /etc/nginx.conf 里面加一句 include 把步骤2创建的配置文件全部包含进来(用 * 号)重启 nginx具体过程下面是具体的配置过程:1、在 /etc/nginx 下创建 vhosts 目录mkdir /etc/nginx/vhosts2、在 /etc/nginx/vhosts/ 里创建一个名字为 example1.com.conf 的文件,把以下内容拷进去server {listen 80;server_name example1.com www. example1.com;access_log /www/access_ example1.log main;location / {root /www/example1.com;index index.php index.html index.htm;}error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /www/example1.com/$fastcgi_script_name;include fastcgi_params;}location ~ /\.ht {deny all;}}3、在 /etc/nginx/vhosts/ 里创建一个名字为 example2.com.conf 的文件,把以下内容拷进去server {listen 80;server_name example2.com www. example2.com;access_log /www/access_ example1.log main;location / {root /www/example2.com;index index.php index.html index.htm;}error_page 500 502 503 504 /50x.html;location = /50x.html {root /usr/share/nginx/html;}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000location ~ \.php$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /www/example2.com/$fastcgi_script_name;include fastcgi_params;}location ~ /\.ht {deny all;}}4、打开 /etc/nginix.conf 文件,在相应位置加入 include 把以上2个文件包含进来user nginx;worker_processes 1;# main server error logerror_log /var/log/nginx/error.log ;pid /var/run/nginx.pid;events {worker_connections 1024;}# main server confighttp {include mime.types;default_type application/octet-stream;log_format main '$remote_addr - $remote_user [$time_local] $request ''"$status" $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';sendfile on;#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;gzip on;server {listen 80;server_name _;access_log /var/log/nginx/access.log main;server_name_in_redirect off;location / {root /usr/share/nginx/html;index index.html;}}# 包含所有的虚拟主机的配置文件include /usr/local/etc/nginx/vhosts/*;}5、重启 Nginx/etc/init.d/nginx restart。
如何让WordPress支持多站点的创建
自Wordpress3.0及以上版本就支持多站点功能了,只安装一个Wordpress程序即:1、可创建多个wordpress站点,可以是子域名也可以是子目录。
2、可以根据子域名有独立的博客后台和地址。3、管理员可设置开放哪些主题给站点使用。
4、管理员可配置插件给每个站点使用。5、多个站点之间共用“用户数据库表”,也就是表 wp_usermeta 和 wp_users,还有一些别的数据表(wp_blogs,wp_site,wp_singnups,wp_registration_log,wp_blog_versions), 其他的为独立数据库表。
6、 还可以是完全不同的域名《需要手动执行几条SQL语句》下面详解一下wordpress多站点的配置方法:1、首先,备份网站的数据库,以防出现意外时恢复(虽然一般可以忽略,强烈建议做一下,小心驶得万年船)。2、打开wordpress的根目录下的wp-config.php文件,在末尾加上以下代码:/** 开启woredpress多站点支持 */define('WP_ALLOW_MULTISITE',true);/** 开启woredpress多站点支持 */define ( 'WP_ALLOW_MULTISITE' , true ) ;3、进入wordpress后台,”工具”-> 点击”配置网络”ps:1). 如果您要使用二级域名的形式,可以到“设置”->“常规”里面,把站点地址(URL)的www.去掉。
2). 这时DB账号需要有create table 的权限,否则建表失败。4、如果插件没有禁用,会提示先禁用所有插件5、禁用完后后就可以创建了,如果不是全新安装还会有提示:子域名安装 由于您当前的安装不是全新的,所以您WordPress网络中的站点只能使用子域名。
要在主站点为子目录的情况下安装,需要修改固定链接结构,有可能会破坏已有的链接。子域名安装 由于您当前的安装不是全新的,所以您 WordPress 网络中的站点只能使用子域名。
要在主站点为子目录的情况下安装,需要修改固定链接结构,有可能会破坏已有的链接。6、点击安装后提示如下:按说明操作即可完成了。
7、点击安装后,按照提示做好相关的配置8、配置好,再次进入后台,在头部将出现“我的站点”->“管理网络”的选项菜单,接下来您可以管理或者创建站点,也可以开启主题或者插件给其他站点使用。
怎样开启WordPress多站点功能
1.开启网络(Network)。
默认的WordPress是没有开启多站点功能的,我们要开启【网络(Network)】,需要在根目录下的 wp-config.php 文件中,添加下面的代码 1 define('WP_ALLOW_MULTISITE', true); 这样就可以在WordPress管理后台->【工具(Tools)】功能模版中看到【网络(Network)】这个功能了,如下图所示 2.点击【网络(Network)】,就进入到设置页面 (1)在这里需要选择WordPress网络是使用 子域名 还是 子目录 (两者的具体区别可以看上图的例如),这里倡萌选择 子域名。 小贴士:一般而言,所有的主机空间都支持 子目录 样式;但要使用 子域名 样式,必须同时满足下面的条件 ①貌似必须是Linux主机,并且要安装并启用 mod_rewrite 模块(也就是要支持re_write),所以基本上Windows主机是不行的; ②你的主机必须支持 DNS 泛域名解析(即支持在A记录中添加一条星号 *.yourdmain.com 这样的解析) 据倡萌测试发现,一般 DirectAdmin 面板的空间貌似都不支持DNS 泛域名解析,而 cPanel 面板的主机空间有可能支持,或者也可以说 必须是可以添加 无数个 子域名 的主机空间才行。
(测试条件有限,不一定完全正确) 注意:如果你的主机支持DNS 泛域名解析,并且你选择了 子域名 样式,那你就要在主机面板中添加*.yourdmain.com 这样的子域名。并且将你以后要绑定的子域名解析指向到你的主机。
小建议:支持 DNS 泛域名解析的主机空间估计不好找,所以购买空间时一定要咨询主机商,一般的用户还是建议使用 子目录 保险些。 (2)网络详情中的信息可以随便填,然后点击【立即安装】 3.手动完成以下设置:(操作前请注意备份 wp-config.php 和 .htaccess 文件) (1)在 wp-content 目录下 新建一个 blogs.dir 目录,可能要设置为755或777权限。
(2)按上图 第2点 所示,在 wp-config.php 中添加对应的代码到适当的位置。 (3)按上图 第3点所示,覆盖原来的 .htaccess 规则。
4.重新登录后台,就会发现在后台右上角有一个【网络管理(Network Admin)】,点击进去就可以管理 网络了。
如何在Nginx服务器中设置多个站点
这里以配置2个站点(2个域名)为例,n 个站点可以相应增加调整,假设:IP地址: *.*.*.* 域名1 example1.com 放在 /www/example1 域名2 example2.com 放在 /www/example2 配置 nginx virtual hosting 的基本思路和步骤如下:把2个站点 example1.com, example2.com 放到 nginx 可以访问的目录 /www/ 给每个站点分别创建一个 nginx 配置文件 example1.com.conf,example2.com.conf, 并把配置文件放到 /etc/nginx/vhosts/ 然后在 /etc/nginx.conf 里面加一句 include 把步骤2创建的配置文件全部包含进来(用 * 号) 重启 nginx 具体过程 下面是具体的配置过程:1、在 /etc/nginx 下创建 vhosts 目录 mkdir /etc/nginx/vhosts2、在 /etc/nginx/vhosts/ 里创建一个名字为 example1.com.conf 的文件,把以下内容拷进去 server { listen 80; server_name example1.com www. example1.com; access_log /www/access_ example1.log main; location / { root /www/example1.com; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www/example1.com/$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }3、在 /etc/nginx/vhosts/ 里创建一个名字为 example2.com.conf 的文件,把以下内容拷进去 server { listen 80; server_name example2.com www. example2.com; access_log /www/access_ example1.log main; location / { root /www/example2.com; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /www/example2.com/$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } }4、打开 /etc/nginix.conf 文件,在相应位置加入 include 把以上2个文件包含进来 user nginx; worker_processes 1;# main server error log error_log /var/log/nginx/error.log ; pid /var/run/nginx.pid; events { worker_connections 1024; }# main server config http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] $request ''"$status" $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"'; sendfile on;#tcp_nopush on;#keepalive_timeout 0; keepalive_timeout 65; gzip on; server { listen 80; server_name _; access_log /var/log/nginx/access.log main; server_name_in_redirect off; location / { root /usr/share/nginx/html; index index.html; } }# 包含所有的虚拟主机的配置文件 include /usr/local/etc/nginx/vhosts/*; }5、重启 Nginx/etc/init.d/nginx restart。
wordpress 多站点 怎么设置
方法/步骤 用ftp软件或空间的在线ftp功能打开wordpress程序文件夹,找到wp-config.php文件。
我们需要修改这个文件来启动wordpress的多站点功能。 用php的编辑器打开它(我用的是notepad,其实txt文本也能打开,但是容易出现一些问题),按照下图提示加入代码: define('WP_ALLOW_MULTISITE', true); 这时再登陆wordpress网站的后台,你会发现在“工具”下会多了一个“配置网络” 点击“配置网络”会提示你要关闭所有插件,于是关掉所有运行的插件。
此时wordpress会让你修改两个文件:一个是我们之前修个的那个wp-config.php,另一个文件“.htaccess”和它在同一个目录,很好找的。找到后打开添加代码文件,如果你没有“.htaccess”这个文件。
需先在固定链接那里进行设置一下,wordpress会自动生成.htaccess这个文件。 完成修改后重新登录即可。
重新登录后就可以在左上角看到配置网络了! 点击后就可以创建新的分站点了。
转载请注明出处51数据库 » nginxwordpress多站点
一只被吓到的猫