Find the answer to your Linux question:
Results 1 to 5 of 5
using Mint12... I thought I was understanding this, but localhost points to my dev site? What am I doing wrong here. the other two point in the right direction. the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2012
    Posts
    20

    apache2 with multiple sites: localhost points to wrong site


    using Mint12...

    I thought I was understanding this, but localhost points to my dev site? What am I doing wrong here. the other two point in the right direction.

    the 00-default site is the one that came installed with apache2, has not been touched and points to /var/www

    The Sites
    ~ $ ls /etc/apache2/sites-enabled/
    000-default dev wordpress

    The Hosts File
    127.0.0.1 localhost
    127.0.0.1 kevcoder00
    127.0.0.1 wordpress
    127.0.0.1 dev

    thanks
    kevcoder

  2. #2
    Just Joined!
    Join Date
    May 2011
    Location
    Central FL
    Posts
    91
    What do you mean "localhost points to my dev site"? Do you mean that when you go to http;//localhost it goes to the "sites-enabled/dev"? To debug that we'd need the content of the 000-default, dev, and wordpress files.

  3. #3
    Just Joined!
    Join Date
    Jan 2012
    Posts
    20
    Quote Originally Posted by dayid View Post
    What do you mean "localhost points to my dev site"? Do you mean that when you go to http;//localhost it goes to the "sites-enabled/dev"? To debug that we'd need the content of the 000-default, dev, and wordpress files.
    That is exactly what I mean. The info and a screenshot follows.
    Thanks

    #dev /sites/dev/www/dev is symlinked to a folder in my home directory.. if that makes any difference
    Code:
    NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
        ServerAdmin webmaster@localhost
        ServerName dev
        
        DocumentRoot /sites/dev/www/dev
        <Directory />
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
    
        ErrorLog /sites/dev/logs/error.log
    
        LogLevel warn
    
        CustomLog /sites/dev/logs/access.log combined
        ServerSignature On
    
    </VirtualHost>
    #wordpress
    Code:
    NameVirtualHost 127.0.0.1
    <VirtualHost 127.0.0.1>
        ServerAdmin webmaster@localhost
        ServerName wordpress
        
        DocumentRoot /sites/wordpress
        <Directory />
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
    
        ErrorLog /sites/wordpress/logs/error.log
    
        LogLevel warn
    
        CustomLog /sites/wordpress/logs/access.log combined
        ServerSignature On
    
    </VirtualHost>
    a screenshot:apache2_virtual_host.jpg

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    May 2011
    Location
    Central FL
    Posts
    91
    You have two entries with the same namevirtualhost... this is improper. "configtest ( apachectl configtest ) should have warned you about this. You need to correct that. You can't expect apache to magically know which "127.0.0.1" you want when you told it that they are two. Each entry needs its own namevirtualhost.

    Since you already added them in to your /etc/hosts, you should be able to have "NameVirtualHost dev" for one, and "NameVirtualHost wordpress" for the other, then you would visit http://dev & http://wordpress

  6. #5
    Just Joined!
    Join Date
    Jan 2012
    Posts
    20

    Solved

    thanks dayid, that did it

    #dev
    Code:
    NameVirtualHost dev
    <VirtualHost dev>
        ServerAdmin webmaster@localhost
        ServerName dev
        
        DocumentRoot /sites/dev/www/dev
        <Directory />
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
    
        ErrorLog /sites/dev/logs/error.log
    
        LogLevel warn
    
        CustomLog /sites/dev/logs/access.log combined
        ServerSignature On
    
    </VirtualHost>
    #wordpress
    Code:
    NameVirtualHost wordpress
    <VirtualHost wordpress>
        ServerAdmin webmaster@localhost
        ServerName wordpress
        
        DocumentRoot /sites/wordpress
        <Directory />
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
        </Directory>
    
        ErrorLog /sites/wordpress/logs/error.log
    
        LogLevel warn
    
        CustomLog /sites/wordpress/logs/access.log combined
        ServerSignature On
    
    </VirtualHost>
    Last edited by kevcoder; 05-10-2012 at 11:07 PM. Reason: SOLVED

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •