Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Apache Virtual Hosts problem

Posted on 2004-11-01
7
Medium Priority
?
305 Views
Last Modified: 2013-11-18
I have a dns server set up for http://dirtywerm.com, what I want to do now is set up apache virtual hosting.

Everytime I try to enable the virtual hosting everything but localhost stops working.

I'm not sure if the problem is to do with my dns server or if i'm doing something wrong with apache.

So what I'm trying to do is make sure that my domain name works both locally and externally using virtual hosts.
0
Comment
Question by:dirtywerm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 

Author Comment

by:dirtywerm
ID: 12468572
Also I am using apache 2

When I try to enable virtual hosting I uncomment the following line:
#Include conf/vhosts/vhosts.conf


Here is vhosts.conf:

NameVirtualHost *
<VirtualHost *>
ServerName dirtywerm.com
DocumentRoot /var/www/dirtywerm/htdocs
</VirtualHost>

/var/www/dirtywerm is just a copy of /var/www/localhost


0
 
LVL 40

Accepted Solution

by:
jlevie earned 2000 total points
ID: 12468628
It would most helpful to know what version of Apache you are using.

For a 2.x version of Apache you'd configure virtual hosts by having something along the lines of:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName "www.dirtywerm.com"
  ServerAlias "dirtywerm.com"
  ServerAdmin "webmaster@dirtywerm.com"
  DocumentRoot "/home/webs/www.dirtywerm.com/htdocs"
  <Directory />
    AllowOverride AuthConfig
    Options FollowSymLinks Multiviews
    Order allow,deny
    Allow from all
  </Directory>
   ScriptAlias /cgi-bin/ "/home/webs/www.dirtywerm.com/cgi-bin/"
  <Directory "/home/webs/www.dirtywerm.com/cgi-bin">
    AllowOverride AuthConfig
    Options ExecCGI
    Order allow,deny
    Allow from all
  </Directory>
  CustomLog "/home/webs/www.dirtywerm.com/logs/access_log" combined
  ErrorLog "/home/webs/www.dirtywerm.com/logs/error_log"
</VirtualHost>

with httpd.conf (with the paths adjusted for local conditions). To have the site work internally and externally you need to ensure that the DNS views for each properly resolve the anme to the appropriate IP. That means that from inside you get an inside IP for the name and from outside you get an outside IP.
0
 

Author Comment

by:dirtywerm
ID: 12468932
Ok, the virtual host is working now but how do I set up bind 9 to working differently internally and externally?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dirtywerm
ID: 12469120
Here is my current named.conf

options {
        directory "/var/bind";

        listen-on-v6 { none; };
        listen-on { 127.0.0.1; 192.168.0.100; };

        pid-file "/var/run/named/named.pid";
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "localhost" IN {
        type master;
        file "pri/localhost.zone";
        allow-update { none; };
        notify no;
};

zone "127.in-addr.arpa" IN {
        type master;
        file "pri/127.zone";
        allow-update { none; };
        notify no;
};

zone "dirtywerm.com" IN {
        type master;
        file "pri/dirtywerm.zone";
        allow-update { none; };
        notify no;
};

zone "b-train.com" IN {
        type master;
        file "pri/btrain.zone";
        allow-update { none; };
        notify no;
};

0
 
LVL 40

Expert Comment

by:jlevie
ID: 12469243
What version of Bind are you using? And is this copy of Bind the only name server for the domain?
0
 

Author Comment

by:dirtywerm
ID: 12469887
For now this is the only name server. I was making sure my set up was right. I am using bind 9.
0
 

Author Comment

by:dirtywerm
ID: 12475710
Would this be the correct way to set up the views?

options {
        directory "/var/bind";

        listen-on-v6 { none; };
        listen-on { 127.0.0.1; 192.168.0.100; };

        pid-file "/var/run/named/named.pid";
};

view "internal" {

        match-clients { localnets; };
        recursion yes;

        zone "." IN {
                type hint;
                file "named.ca";
        };

        zone "localhost" IN {
                type master;
                file "pri/localhost.zone";
                allow-update { none; };
                notify no;
        };

        zone "127.in-addr.arpa" IN {
                type master;
                file "pri/127.zone";
                allow-update { none; };
                notify no;
        };

        zone "dirtywerm.com" IN {
                type master;
                file "pri/dirtywerm.internal";
                allow-update { none; };
                notify no;
        };

        zone "b-train.com" IN {
                type master;
                file "pri/btrain.internal";
                allow-update { none; };
                notify no;
        };
};

view "external" {
        match-clients { any; };
        recursion no;

        zone "dirtywerm.com" IN {
                type master;
                file "pri/dirtywerm.external";
                allow-update { none; };
                notify no;
        };

        zone "b-train.com" IN {
                type master;
                file "pri/btrain.external";
                allow-update { none; };
                notify no;
        };
};

0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question