Thirumalai murugan
Thirumalai murugan

Reputation: 5896

Access Local sub domain with IP in wamp

What I need is as follows

I am able to access the sub domain in my local machine as follows test.localhost but I need test.myMachineName or test.myMachineIp to access from another computer in my own network

I have setup the sub domain in my local wamp server as follows:

IN https-vhost.conf:

<VirtualHost *:80>
    #ServerAdmin [email protected]
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    #ErrorLog "logs/dummy-host.example.com-error.log"
    #CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    #ServerAdmin [email protected]
    DocumentRoot "c:/wamp/www/test"
    ServerName localhost
    ServerAlias test.localhost
    #ErrorLog "logs/dummy-host.example.com-error.log"
    #CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

And then enabled vhost in httpd.conf

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Then added in windows host as follows

127.0.0.1       test.localhost

Upvotes: 1

Views: 1681

Answers (1)

Dragos Sandu
Dragos Sandu

Reputation: 664

I don't understand your configuration. First, if you access test.localhost from another computer will not work because your website does not exist on that computer. You have to use the IP address and port forwarding in your router settings (Private IP: Computer local IP, Type: TCP, Range: 80 - 80).

In https-vhost.conf:

<VirtualHost *:80>
    #ServerAdmin [email protected]
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    #ErrorLog "logs/dummy-host.example.com-error.log"
    #CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    #ServerAdmin [email protected]
    DocumentRoot "c:/wamp/www/test"
    ServerName test.youripaddress
    ServerAlias test.youripaddress
    #ErrorLog "logs/dummy-host.example.com-error.log"
    #CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>

In HOST file:

127.0.0.1           localhost
youripaddress       test.youripaddress

Ask me any questions.

Upvotes: 1

Related Questions