1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help with virtual host.

Discussion in 'Apache' started by JohnD2117, Jul 3, 2017.

  1. #1
    NameVirtualHost 127.0.0.1:80
    
    <VirtualHost 127.0.0.1:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
    </VirtualHost>
    
    <virtualhost *:80>
        ServerAdmin webmaster@doogals.home
        DocumentRoot "c:/xampp/htdocs/doogals"   
        ServerName doogals.home
        ServerAlias *.doogals.home
        ErrorLog "c:/xampp/htdocs/doogals/logs/doogals.home-error.log"
        CustomLog "c:/xampp/htdocs/doogals/logs/doogals.home-access.log" common
        <Directory "c:/xampp/htdocs/doogals">
            AllowOverride All
            Options Indexes FollowSymLinks Includes ExecCGI
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
    Code (ApacheConf):

    SEMrush
     
    JohnD2117, Jul 3, 2017 IP
    SEMrush
  2. webhost.uk.net

    webhost.uk.net Active Member

    Messages:
    283
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    78
    #2
    Not quit able to understand what exact help you are looking for?
     
    webhost.uk.net, Jul 3, 2017 IP
  3. JohnD2117

    JohnD2117 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Yes Sorry about that. I don't know what happened there, one minute I was creating a post, the next it had gone. Here is what was meant to be in it:

    I have this setup on a desktop which I'm trying to set up as a local server. This is the software I'm using:

    Xampp 3.2.2 compiled Nov 12 2015
    Apache 2.4.25 (win32) Open SSL 1.0.2j Ports 80, 443 php 5.6.30
    OS Windows 10 latest version & updates

    My Vhost.conf is:
    
    NameVirtualHost 127.0.0.1:80
    
    <VirtualHost 127.0.0.1:80>
     DocumentRoot "C:/xampp/htdocs/"
     ServerName localhost 
    </VirtualHost>
    
    <virtualhost *:80>
     ServerAdmin webmaster@doogals.home
     DocumentRoot "c:/xampp/htdocs/doogals" 
     ServerName doogals.home
     ServerAlias *.doogals.home
     ErrorLog "c:/xampp/htdocs/doogals/logs/doogals.home-error.log"
      CustomLog "c:/xampp/htdocs/doogals/logs/doogals.home-access.log" common
     <Directory "c:/xampp/htdocs/doogals">
     AllowOverride All
     Options Indexes FollowSymLinks Includes ExecCGI
     Order allow,deny
     Allow from all
     </Directory>
    </VirtualHost>
    
    Code (markup):
    Hosts:
    127.0.0.1 localhost
    127.0.0.1 doogals.home
    192.168.1.17 doogals.home

    Networks:
    loopback 127
    doogals.home 192.168.1.17

    From my server:
    if I use the IP address I get "It works" displayed
    Using "doogals.home" I get an index file in hdocs displayed
    Using localhost I get the, correct, index file from the doogals directory displayed.

    From a local laptop:
    If I use the IP address I get the index file from doogals displayed.
    Using "doogals.home" I get "can't be found" message.

    I have studied the virtualhost docs 'till my head spins. Why can't I get a response from doogals.home?
     
    JohnD2117, Jul 3, 2017 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,622
    Likes Received:
    717
    Best Answers:
    151
    Trophy Points:
    420
    #4
    Try changing the
    
    NameVirtualHost: 127.0.0.1:80
    
    Code (markup):
    to
    
    NameVirtualHost: *:80
    
    Code (markup):
    You can probably also just lose the
    
    <VirtualHost 127.0.0.1:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
    </VirtualHost>
    
    Code (markup):
    unless you need to have access to the web-host root from the browser (which you shouldn't) - if you need to keep it, remove the 127.0.0.1 and change the full VirtualHost-group to this:
    
    <VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/"
    ServerName localhost
    </VirtualHost>
    <virtualhost *:80>
    ServerAdmin webmaster@doogals.home
    DocumentRoot "c:/xampp/htdocs/doogals"
    ServerName doogals.home
    ServerAlias *.doogals.home
    ErrorLog "c:/xampp/htdocs/doogals/logs/doogals.home-error.log"
    CustomLog "c:/xampp/htdocs/doogals/logs/doogals.home-access.log" common
    <Directory "c:/xampp/htdocs/doogals">
    AllowOverride All
    Options Indexes FollowSymLinks Includes ExecCGI
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>
    
    Code (markup):
     
    PoPSiCLe, Jul 5, 2017 IP
  5. JohnD2117

    JohnD2117 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    That is great. I have done a copy and past to Notpad++ and will do the same to my conf file.

    I have resolved the problem I was having. It was another one of those dumb newbee things. I prefix doogals.home with http:// in my hosts file.:)

    Kind regards John
     
    JohnD2117, Jul 5, 2017 IP