Can't get to subsites. Wildcard-subdomains probably misconfigured in Apache

蹲街弑〆低调 提交于 2019-12-25 12:45:41

问题


I'm building a portal for the organization I'm working at.

The portal is a Wordpress site using Wampserver 2.5, intalled on a Win server 2008 R2.

It's working fine and accesible from other machines over the intranet, thanks to the helpful and patient RiggsFolly.

But now, I have changed it into a network of sites so that I can build sub-portals for the different departments in my organization.

During that change Wordpress gave this warning message: Warning! Wildcard DNS may not be configured correctly!

Wordpress has a page explaining how to configure wildcard subdomains on Apache - http://codex.wordpress.org/Configuring_Wildcard_Subdomains.

I tried following it but the explanation lacks details and I'm probably doing something wrong.

On the machine where the servers and site are installed, when I write http://hipo (hipo is the current site name) in the browser's address bar, I get to the site fine.

But when I write http://depa.hipo (depa is a subsite I created successfully), the address changes into http://www.depa.hipo/ and the browser says it didn't find a server at that address.

I have probably set the ServerAlias line wrong in httpd-vhosts.conf, and also I didn't add the line *.example.com A 192.0.43.10, or in my case *.hipo A <rightIP>, cause I wasn't sure where to add it in the file.

This is my httpd-vhosts.conf file. Your help is appreciated!

 <VirtualHost *:80>
     DocumentRoot "c:/wamp/www/hipo"
     ServerName hipo
     <Directory  "c:/wamp/www/hipo">
        AllowOverride All
        Require all granted
     </Directory>
 </VirtualHost>

 <VirtualHost *:80>
     DocumentRoot "c:/wamp/www/hipo"
     ServerName subsites.hipo
     ServerAlias *.hipo
     <Directory  "c:/wamp/www/hipo">
        AllowOverride All
        Require all granted
     </Directory>
 </VirtualHost>

 <VirtualHost *:80>
     DocumentRoot "c:/wamp/www"
     ServerName localhost
     ServerAlias localhost
     <Directory  "c:/wamp/www">
        AllowOverride All
        Require all granted
     </Directory>
 </VirtualHost>

回答1:


This definition does not have a ServerAlias so try adding one like this:

<VirtualHost *:80>
     DocumentRoot "c:/wamp/www/hipo"
     ServerName hipo
     ServerAlias www.hipo
     <Directory  "c:/wamp/www/hipo">
        AllowOverride All
        Require all granted
     </Directory>
 </VirtualHost>


来源:https://stackoverflow.com/questions/24775443/cant-get-to-subsites-wildcard-subdomains-probably-misconfigured-in-apache

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