Hi,
As I understand your situation, you will need to use Name-based virtual hosts in Apache. This means that you only have one public IP that points to the same server and you need two different sites to be hosted in this server.
The first thing you need to do is make sure Apache works for a single site without any additional configuration. Depending on your version of Apache and your Linux distributon, configuration files might be located in different places and might vary slightly. In my case, I am using openSuSE 11.0 and Apache 2. My main configuration file is httpd.conf. It has a line like this:
Code:
Include /etc/apache2/vhosts.d/*.conf
This is just done to include a configuration file from a different folder in order to make Apache more modular. My virtual host configuration is located in /etc/apache2/vhosts.d/yast2_vhosts.conf
In this file, we have to tell Apache that we are going to use name-based virtual hosting for all IP addresses in port 80. We use the following directive:
Code:
NameVirtualHost *:80
Then, we have to configure each virtual host. This is what your virtual host configuration file is going to look like for your sites (I'll explain in a minute:
Code:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName site1.net
ServerAlias www.site1.net
ServerAdmin webmaster@site1.net
DocumentRoot /srv/www/htdocs/www.site1.net/
<Directory /srv/www/htdocs/www.site1.net/>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
<VirtualHost *:80>
ServerName site2.net
ServerAlias www.site2.net
ServerAdmin webmaster@site2.net
DocumentRoot /srv/www/htdocs/www.site2.net/
<Directory /srv/www/htdocs/www.site2.net/>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.html index.php
</VirtualHost>
As you can see, the two virtual hosts are basically the same thing, except for the names of the hosts (site1.net vs site2.net). For each host, we have to specify the name and the aliases. The aliases are other names that Apache will use for this host. The DocumentRoot directive tells Apache where the files for this host are. Then, we use the Directory section to define permissions for the host. In this example, we are basically allowing the public to access the site, but we could easily tell Apache to allow a group of IP addresses. The DirectoryIndex directive tells Apache what the default file to show is if the client does not request an specific file. ServerAdmin is the administrator of the site.
You might wonder, what happens if the client requests the site by IP address instead of a name. As far as I know (can somebody verify this?), Apache will use the first defined virtual host as a default. In this case, that would be site1.net. Apache uses the HTTP request headers to determine which virtual host to use. Also, as far as I know (can somebody verify this too?), any directives that you don't define inside a VirtualHost section will have the value of the default server, which is probably configured in httpd.conf
After you have done all these changes, restart Apache.
Lastly, you need to configure your DNS server (which I assume is hosted at no-ip.com) to make the
www.site1.net and
www.site2.net point to the same IP address. This is the public IP of your web server. Also, you probably need to define these names inside your /etc/hosts file.
If you have any questions, I'll be happy to answer