WordPress multisite setup as subdomain - wildcard DNS record setup

筅森魡賤 提交于 2019-12-13 16:15:35

问题


I am new to WP multisite environment. I want to setup multisite in my local Ubuntu 14.04 environment. I already have localhost for my main site configured as carbazarlocal.com and its running OK. When I go to Tools > Network Setup I can see two options - Sub-domain and Sub-directory. I want to setup my multisites as sub-domains like dealer1.carbazarlocal.com, dealer2.carbazarlocal.com etc.

On this page WordPress says "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality". How to do this and where?

In /etc/hosts I have the following entry:

127.0.0.1   carbazarlocal.com

In /etc/apache2/apache2.conf I have the following:

<Directory /var/www/html/carbazar>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

In /etc/apache2/sites-available/carbazarlocal.com.conf I have this:

<VirtualHost *:80>
     ServerAdmin admin@carbazarlocal.com
     ServerName carbazarlocal.com
     ServerAlias *.carbazarlocal.com
     DocumentRoot /var/www/html/carbazar
</VirtualHost>

And in /var/www/html/carbazar/wp-config I have this:

define('WP_ALLOW_MULTISITE', true);

What else I need to do and where to complete the following step: "You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality"?


回答1:


If you use Apache server then ...

In the httpd.conf file, or in the include file containing the VirtualHost section for your web account, add a line like this (if it is not already present):

ServerAlias *.example.com

Also create a wildcard DNS record like:

*.example.com A 192.0.43.10

REF https://codex.wordpress.org/Configuring_Wildcard_Subdomains


来源:https://stackoverflow.com/questions/42857061/wordpress-multisite-setup-as-subdomain-wildcard-dns-record-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!