Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

im trying to set up local subdomain for my new site, i can w/o problem access url: serverxyz from any pc in my network, but when it comes to subdomains it is only possiable from PC that host subdomains, ig sub1.localhost, sub2.localhost. I want to give pc's in my local network to acess my subdomains, i use WAMP.

my hosts :

localhost       maintence
localhost       kadry.maintence

my httpd.conf

DocumentRoot "C:\wamp\www"
<Directory "C:\wamp\www">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
#    Require all granted
#   onlineoffline tag - don't remove
 Order Deny,Allow
 Deny from all
 Allow from all

</Directory>

my httpd-vhosts.conf:

<VirtualHost *:80>
ServerName maintence
ServerAlias maintence
DocumentRoot "C:\wamp\www"
ErrorLog "logs\errors.log"
<directory "C:\wamp\www">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from all
</directory>
</VirtualHost>

<VirtualHost *:80>
ServerName maintence
ServerAlias *.maintence
VirtualDocumentRoot "C:\wamp\www\subdomains\%1"
ErrorLog "logs\errors.log"
<directory "C:\wamp\www\subdomains\%1">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from all
</directory>
</VirtualHost>

i think my WAMP server doesn't see httpd-vhosts.conf but maybe there is another my mistake any help would be great.

share|improve this question
add comment

1 Answer

If it works with the computer hosting the website, I guess your configuration is correct already. But because you match the domain using the same port, and only differs it using the hostname, the other won't be able to access your subdomain because even if the ip is correct, the hostname is wrong.

One solution is to make your router maps the domain to your local computer (the one hosting the site). Another solution is also to edit the hosts file of the the computer trying to access the subdomain. So, for each computer wanting to access the subdomain, their hostfile should contain

192.168.1.5       maintence
192.168.1.5       kadry.maintence

But please change the ip address to the address of the computer hosting the website (192.168.1.5 is just an example).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.