15

我正在运行一个网站http://localhost:8080/sitename。但是,当我尝试使用 wordpress 创建站点网络时,出现以下错误Tools-> Network

ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080.

我试图创建一个虚拟主机和一个假域,但我无法让它工作。我该如何解决?

4

3 回答 3

51

目前,Wordpress 似乎只支持 80 和 443 端口。使用任何自定义(即 http 8080)端口的临时可能解决方法:

  1. 打开wp-admin/includes/network.php并找到它提到的代码部分array( ':80', ':443' )并将其添加:8080到该数组中。

  2. 完成网络设置后,您可能需要进行wp-config以下调整:
    define( 'DOMAIN_CURRENT_SITE', 'example.com'. (stristr($_SERVER['PHP_SELF'],'wp-login.php') ? '':':8080') );

  3. 正如评论(感谢)在创建第一个子站点后指出的那样,它可能在域名中嵌入了端口号,所以尝试进入 Mysql 数据库(即尝试托管的 phpMyAdmin,甚至在开始程序之前安装插件_blogs)和& _site&_options表,调整子站点的主页 url(即从域中分离端口号)。

  4. 就这样。再次登录您的项目。

于 2014-12-20T16:30:52.423 回答
1

From my experience, WP is not designed to use custom ports for multi-sites so the blogs (sub-sites) hosts get messed up in the DB.

My solution: After you switch to multi-site or create a new site, you need to go to your db admin page (e.g. phpMyAdmin) and fix the blogs domain in the wp_blogs table. Basically WP failed to add a colon between the host and port; just have to add it-> localhost8080 becomes localhost:8080. So, on the site's settings add the missing colon to the siteurl and home urls.

于 2021-10-24T14:06:49.767 回答
-2

我找到了临时解决方案:

在 CMD 中运行“netstat -o -n -a | findstr 0.0.80”将向您显示哪个服务正在使用端口 80。如果 PID 为 4,则表示系统使用端口 80(可能是 IIS 或 Web 矩阵,如果它已安装 - 这是我的情况)。我从 IIS 管理器更改了 IIS 正在使用的端口,并且我还停用了也使用端口 80 的 MsDepSvc 服务(Web Matrix)。之后,我重新配置 apache 以在端口 80 中工作,一切正常!

于 2012-07-08T10:29:03.043 回答