admin管理员组文章数量:1122833
I am following This tutorial to Create a Network of WordPress Sites . After adding
/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
to my wp-config.php
file and when I start to configure multisite network I got this error
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080
I try to change
Listen 0.0.0.0:8080
Listen [::0]:8080
to
Listen 0.0.0.0:80
Listen [::0]:80
from httpd.conf
of Apache but due to this wamp server remains orange .
How to solve this .I am a new to WordPress Any help would be highly appreciated .
I am following This tutorial to Create a Network of WordPress Sites . After adding
/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
to my wp-config.php
file and when I start to configure multisite network I got this error
ERROR: You cannot install a network of sites with your server address.
You cannot use port numbers such as :8080
I try to change
Listen 0.0.0.0:8080
Listen [::0]:8080
to
Listen 0.0.0.0:80
Listen [::0]:80
from httpd.conf
of Apache but due to this wamp server remains orange .
How to solve this .I am a new to WordPress Any help would be highly appreciated .
2 Answers
Reset to default 10Update: Finally supported in WP 6.6. The core ticket here was recently merged in and closed.
Older answer:
Warning: This is just a test for dev installs and not production sites
I was curious to see if there was a workaround, for those who want to develope multisites on their dev installs but on different ports than :80
and :443
, e.g. :8080
.
I only found this blog post by Henri Benoit. There he gives examples how to modify the 3.9.1 core, to get around the core restrictions.
Here's a must-use plugin /wp-content/mu-plugins/wpse-ms-on-different-port.php
where we try to avoid core modifications:
<?php
/**
* Test for multisite support on a different port than :80 and :443 (e.g. :8080)
*
* Here we assume that the 'siteurl' and 'home' options contain the :8080 port
*
* WARNING: Not suited for production sites!
*/
/**
* Get around the problem with wpmu_create_blog() where sanitize_user()
* strips out the semicolon (:) in the $domain string
* This means created sites with hostnames of
* e.g. example.tld8080 instead of example.tld:8080
*/
add_filter( 'sanitize_user', function( $username, $raw_username, $strict )
{
// Edit the port to your needs
$port = 8080;
if( $strict // wpmu_create_blog uses strict mode
&& is_multisite() // multisite check
&& $port == parse_url( $raw_username, PHP_URL_PORT ) // raw domain has port
&& false === strpos( $username, ':' . $port ) // stripped domain is without correct port
)
$username = str_replace( $port, ':' . $port, $username ); // replace e.g. example.tld8080 to example.tld:8080
return $username;
}, 1, 3 );
/**
* Temporarly change the port (e.g. :8080 ) to :80 to get around
* the core restriction in the network.php page.
*/
add_action( 'load-network.php', function()
{
add_filter( 'option_active_plugins', function( $value )
{
add_filter( 'option_siteurl', function( $value )
{
// Edit the port to your needs
$port = 8080;
// Network step 2
if( is_multisite() || network_domain_check() )
return $value;
// Network step 1
static $count = 0;
if( 0 === $count++ )
$value = str_replace( ':' . $port, ':80', $value );
return $value;
} );
return $value;
} );
} );
I just tested this on my dev install, but this might need more checks of course ;-)
You can't use port 8080. I have no idea why as that is a fairly common port for a web server. However, you can't:
121 if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ) ) ) ) {
122 echo '<div class="error"><p><strong>' . __( 'ERROR:') . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
123 echo '<p>' . sprintf(
124 /* translators: %s: port number */
125 __( 'You cannot use port numbers such as %s.' ),
126 '<code>' . $has_ports . '</code>'
127 ) . '</p>';
128 echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Return to Dashboard' ) . '</a>';
129 echo '</div>';
130 include( ABSPATH . 'wp-admin/admin-footer.php' );
131 die();
132 }
Notice ! in_array( $has_ports, array( ':80', ':443' ) )
. Those ports are hard-coded. There are no filters you can use to alter them, not even in get_clean_basename()
(and I am afraid to guess at what horrors you'd create if you could alter what that returns).
Alter your server to use port 443 or port 80 instead.
本文标签: apacheMultisite Network Port Num Issues
版权声明:本文标题:apache - Multisite Network Port Num Issues? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736300452a1930818.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
echo get_clean_basedomain();
? Supported ports seems to be:80
and:443
. – birgire Commented Dec 27, 2015 at 15:37