Search code examples
linuxapachevirtualhosthostsdocument-root

/etc/hosts configuration not being detected


Am configuring a local linux development environment utilizing apache, i can access the url:

http://localhost:8080 

but not the configured virtualhost entries which are also present in the /etc/hosts file e.g if i enter:

http://admin:8080 

in my browser redirects me to www.admin.com, which is an external address.

/etc/hosts file has the following entries:

127.0.0.1   localhost admin jobboard

127.0.1.1   rob-VirtualBox

Apache config(virtual hosts reference the above entries admin and jobboard):

Listen 8080

Port 8080

ServerName 127.0.0.1:8080

DocumentRoot "/var/www/html/BigRedSkyASAP/virtualhosts"

<Directory "/var/www/html/BigRedSkyASAP/virtualhosts">

NameVirtualHost *:8080

<VirtualHost 127.0.0.1:8080>
ServerName admin

# set the document root
DocumentRoot "/var/www/html/BigRedSkyASAP/virtualhosts/Client-asap.bigredsky.com"

# set the directory settings
<Directory "/var/www/html/BigRedSkyASAP/virtualhosts/Client-asap.bigredsky.com">
    Options All Includes Indexes
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
ServerName jobboard

# set the document root
DocumentRoot "/var/www/html/BigRedSkyASAP/virtualhosts/JobBoard-asapdev.bigredsky.com"

# set the directory settings
<Directory "/var/www/html/BigRedSkyASAP/virtualhosts/JobBoard-asapdev.bigredsky.com">
    Options All Includes Indexes
    Order allow,deny
    Allow from all
</Directory>
</VirtualHost>

Apache and Computer was restarted after changes to config files were saved. Is their some other hosts configuration file which needs to be modified? Running linux mint OS.

Thanks in advance.


Solution

  • in the virtual host config try this for admin

    ServerAlias admin

    that should resolve the admin website to local server furthermore check whether you are under any proxy...you should turn it off...