Welcome Guest. Please Login or Register  


You are here: Index > AMPPS > General Support > Topic : Using multiple domains



Threaded Mode | Print  

 Using multiple domains (10 Replies, Read 14138 times)
unclepips
Group: Member
Post Group: Newbie
Posts: 5
Status:
I have used Apache for serving websites on our servers for several years now, with a single public IP address.

To achieve this, I have always modified the HTTPD-VHOSTS.CONF file similar to below:-

For Domain 1:-
ServerName domain1.com
ServerAlias www.domain1.com
<Directory "d:\htdocs\domain1">

For Domain 2:-
ServerName domain2.com
ServerAlias www.domain2.com
<Directory "d:\htdocs\domain2">

etc.

The DNS for each domain was set to the single public IP address.
Then whenever you typed www.domain1.com it would serve the files in d:\htdocs\domain1  and if you typed www.domain2.com it would serve the files in d:\htdocs\domain2 etc.

I have now setup AMPPS and added the domains but it appears that the only way to get the files served would be to type:-

www.domain1.com\domain1
www.domain2.com\domain2

etc.

When I open the HTTPD-VHOSTS.CONF file it shows what I would expect:-

NameVirtualHost www.domain1.com:80
<VirtualHost www.domain1.com:80>
<Directory "d:/ampps/www/domain1">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
</Directory>
ServerName www.domain1.com
ServerAlias www.domain1.com
ScriptAlias /cgi-bin/ "d:/ampps/www/domain1/cgi-bin/"
DocumentRoot "d:/ampps/www/domain1/"
ErrorLog "D:/Ampps/apache/logs/www.domain1.com.err"
CustomLog "D:/Ampps/apache/logs/www.domain1.com.log" combined
</VirtualHost>

But if I type www.domain1.com I get the files in the root of www and NOT the files in the folder domain1.

In the main httpd.conf file it shows:-

ServerRoot "D:/Ampps/apache"
DocumentRoot "D:/Ampps/www"

Hopefully I am being a bit thick, and have missed something obvious in the setup, but to be honest, I have been over and over this and as far as I can see it should work.

Any help would be appreciated, thanks in advance.

-----------------------
If it ain't broke...... Fix it until it is!
IP: --   

Using multiple domains
tidus
Group: AMPPS Team
Post Group: Super Member
Posts: 1096
Status:
Hi,

Yes. This should work.

Can you try giving the IP of the domain instead of domain name?

-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack
IP: --   

Using multiple domains
unclepips
Group: Member
Post Group: Newbie
Posts: 5
Status:
Thanks Tidus for your reply.

Using an IP address only gets me to the root of WWW (same effect as if I use a domain name or not).

I uninstalled AMPPS, rebooted, re-installed and went through it all step-by-step doing screen shots as I went. So I could refer back to them if needed.

However, I am getting exactly the same result. If I do a PING test to both domain1.com and domain2.com I get the public IP address of the server, just as I would expect.

But for some reason AMPPS is ignoring the subfolders and purely serving the files from the root of d:\wampps\www\  :o(

-----------------------
If it ain't broke...... Fix it until it is!
IP: --   

Using multiple domains
tidus
Group: AMPPS Team
Post Group: Super Member
Posts: 1096
Status:
Hi,

Strange. We will try to generate the same error here as well.

Till then you can try adding vhost manually as you used to do it before. Make the following changes in httpd.conf.

Change the line
Code
Include conf/extra/httpd-vhosts.conf
to
Code
#Include conf/extra/httpd-vhosts.conf
and add the following line below
Code
Include conf/extra/your-file.conf
In your-file.conf, you can add the following lines as you did.

Code
ServerName domain1.com
ServerAlias www.domain1.com
<Directory "d:\htdocs\domain1">

ServerName domain2.com
ServerAlias www.domain2.com
<Directory "d:\htdocs\domain2">
then restart apache server.

Note: Don't do anything manually in httpd-vhosts.conf file as AMPPS would change it according to domains added by ampps.

-----------------------
Follow AMPPS on,
Twitter : https://twitter.com/AMPPS_Stack
Facebook :  http://www.facebook.com/softaculousampps
Google+ : https://plus.google.com/+AmppsStack
IP: --   

Using multiple domains
unclepips
Group: Member
Post Group: Newbie
Posts: 5
Status:
I did as you suggested, and copied a previously used vhosts file, and it worked :o)

Although my original vhosts file was only basic (didn't have errorlog or customlog etc.), so I have been comparing my vhosts and the auto-generated one.

I have found that if you don't declare the website domain in both NameVirtualHosts  and in <VirtualHost> then it works. So instead of putting a domain name, just put the wildcard *:80

Also, Only need to declare NameVirtualHost *:80 once at the beginning after the NameVirtualHost 127.0.0.1:80


My working vhosts file is as follows:-


#CREATED BY UNCLEPIPS
NameVirtualHost 127.0.0.1:80
NameVirtualHost *:80

<VirtualHost *:80>
<Directory "d:/ampps/www/domain1">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
</Directory>
ServerName domain1.com
ServerAlias www.domain1.com
ScriptAlias /cgi-bin/ "d:/ampps/www/domain1/cgi-bin/"
DocumentRoot "d:/ampps/www/domain1"
ErrorLog "D:/Ampps/apache/logs/domain1.com.err"
CustomLog "D:/Ampps/apache/logs/domain1.com.log" combined
</VirtualHost>

<VirtualHost *:80>
<Directory "d:/ampps/www/domain2">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    allow from All
</Directory>
ServerName domain2.com
ServerAlias www.domain2.com
ScriptAlias /cgi-bin/ "d:/ampps/www/domain2/cgi-bin/"
DocumentRoot "d:/ampps/www/domain2"
ErrorLog "D:/Ampps/apache/logs/domain2.com.err"
CustomLog "D:/Ampps/apache/logs/domain2.com.log" combined
</VirtualHost>

Cheers,
Phil

-----------------------
If it ain't broke...... Fix it until it is!
IP: --   

97206
aiwetir
Group: Member
Post Group: Newbie
Posts: 4
Status:
I'm following these directions exactly, have been using MAMP for many years.  I tried your-file.conf and Apache won't start.

If I use httpd-vhosts.conf as it is in the httpd.conf file Apache will start but it just takes me to AMPPS/www still.
IP: --   

97206
aiwetir
Group: Member
Post Group: Newbie
Posts: 4
Status:
Ugh, sorry again.  I figured out what I was doing wrong again. 
IP: --   

Using multiple domains
samredman
Group: Member
Post Group: Newbie
Posts: 4
Status:
The current version of Ampps hosts domains exactly as programmed.
I am able to host domains perfectly just using the control panel forms (click the Add Domain button and follow the prompts). 

This posting thread is actually confusing because whatever problem the Original Poster was experiencing has been resolved now.

The key piece of information in this thread which is quite valid is this:

Quote
Note: Don't do anything manually in httpd-vhosts.conf file as AMPPS would change it according to domains added by ampps.

Of course, you must first have your domain name directed at your registrar to a nameserver, which you set up to so internet requests for that domain go to the ip address for your web server (I use zoneedit,com for my nameserver service) 

Also, your website files (docs) must be placed in the directory for your domain name which was auto-created by Ampps inside the www directory.

IP: --   

Using multiple domains
samredman
Group: Member
Post Group: Newbie
Posts: 4
Status:
I spoke to soon. The problem has returned.
IP: --   

Using multiple domains
samredman
Group: Member
Post Group: Newbie
Posts: 4
Status:
should have said, "too" soon.
IP: --   

Using multiple domains
samredman
Group: Member
Post Group: Newbie
Posts: 4
Status:
It's working!!

The solution:  I followed exactly the recommendations in the posting from Tidus above (creating a new custom extra conf file for the "extra" directory and then in httpd.conf, adding the new while commenting out the standard one).  Evidently, the custom extra file is respected while the conventional extra file as supplied isn't.  So I now have my domain name going directly to its "doc" directory and the website showing properly.

IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is September 1, 2014, 11:18 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 11  |  Page Created In:0.628