Find the answer to your Linux question:
Results 1 to 7 of 7
I want to be able to view websites from my test linux server and not from the internet. I have only one IP assigned to the server: 10.0.3.151 I want ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2004
    Posts
    34

    Virtual Host question


    I want to be able to view websites from my test linux server and not from the internet.

    I have only one IP assigned to the server: 10.0.3.151

    I want to be able to put phpmyadmin in one location and the rest of my website in another

    I was thinking something like this but it is not working:
    <VirtualHost *:80>
    ServerName phpmyadmin.localhost
    DocumentRoot /var/www/phpmyadmin
    </VirtualHost>

    Please advise

  2. #2
    Just Joined!
    Join Date
    Jan 2005
    Location
    Toronto, ON, Canada
    Posts
    79
    FromApache VHOST doc :
    For example, suppose that you are serving the domain www.domain.tld and you wish to add the virtual host www.otherdomain.tld, which points at the same IP address. Then you simply add the following to httpd.conf:

    NameVirtualHost *

    <VirtualHost *>
    ServerName www.domain.tld
    DocumentRoot /www/domain
    </VirtualHost>

    <VirtualHost *>
    ServerName www.otherdomain.tld
    DocumentRoot /www/otherdomain
    </VirtualHost>
    You can alternatively specify an explicit IP address in place of the * in both the NameVirtualHost and <VirtualHost> directives. The IP address is required in version 1.3.12 and earlier.

    Many servers want to be accessible by more than one name. This is possible with the ServerAlias directive, placed inside the <VirtualHost> section. For example if you add this to the first <VirtualHost> block above

    ServerAlias domain.tld *.domain.tld
    then requests for all hosts in the domain.tld domain will be served by the www.domain.tld virtual host. The wildcard characters * and ? can be used to match names. Of course, you can't just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server.
    I hope this help

    afrolinux

  3. #3
    Just Joined!
    Join Date
    Oct 2004
    Posts
    34
    no not really. I do not have a domain to add to virtual host

    I want to have something like

    phpmyadmin.localhost - phymyadmin
    and
    localhost - main site

  4. #4
    Just Joined!
    Join Date
    Jan 2005
    Location
    Toronto, ON, Canada
    Posts
    79
    Here the problem is not about being a new domain or host it is the same. The problem is even Apache(Server) knows when it recieve a request for MyPhpadmin.localhost(or only MyPhpadmin if you put server alias in httpd.conf) where to go, how the Internet browser(Client) resolve the MyPhpadmin.localhost or MyPhpAdmin to do the request to the apache. That is a problem even being in the same host. When the browser does gethostbyname('MyPhpadmin.localhost' or 'MyPhpadmin') it will fail no matter Apache consider it is declared, because the system does not about it.

    One possible easy way without configuring subdomains (I have not tested it) is to set in your /etc/hosts an entry for MyPhpadmin pointing your loopback(127.0.0.1) anf declare in httpd.conf as server alias "MyPhpadmin". Try it. If apache does not like it you can allways set up subdomains as refered in the manual.

    afrolinux

  5. #5
    Linux Guru sarumont's Avatar
    Join Date
    Apr 2003
    Location
    /dev/urandom
    Posts
    3,682
    As afro said, the browser won't know where to look for anything .localhost unless you change your /etc/hosts to make it know where the subdomain is. The way this is normally handled, though, is in your DNS server's configuration. Just in case you wanted to know.
    "Time is an illusion. Lunchtime, doubly so."
    ~Douglas Adams, The Hitchhiker's Guide to the Galaxy

  6. #6
    Just Joined!
    Join Date
    Dec 2004
    Posts
    49
    how do i find what version of apache i'm running and if 1.3.12 or below upgrade?

  7. #7
    Just Joined!
    Join Date
    Jan 2005
    Location
    Toronto, ON, Canada
    Posts
    79
    I suppose you are runnig LINUX. In that case httpd -v should give you the version number.

Posting Permissions

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