[opensuse] 2 domains on Apache
I'm sure this has been asked a thousand times, but how do I set up Apache to serve up 2 different pages for 2 different domains? Also I'm on a dynamic IP and have dyndns.org running fine for one domain. I suppose they can handle a second one to this domain, as long as I switch that domain over to them? Thanks for any pointers. Jim F -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Jim Flanagan wrote:
I'm sure this has been asked a thousand times, but how do I set up Apache to serve up 2 different pages for 2 different domains? Also I'm on a dynamic IP and have dyndns.org running fine for one domain. I suppose they can handle a second one to this domain, as long as I switch that domain over to them?
Thanks for any pointers.
Jim F
Two domains? Do you mean 2 different host names for the same IP address? If you use the same address for both, there's no way to tell which server to connect to, unless you use different ports, but DNS servers don't specify port numbers. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Friday 17 Aug 2012 18:37:33 Jim Flanagan wrote:
I'm sure this has been asked a thousand times, but how do I set up Apache to serve up 2 different pages for 2 different domains? Also I'm on a dynamic IP and have dyndns.org running fine for one domain. I suppose they can handle a second one to this domain, as long as I switch that domain over to them?
You want to enable name based virtual hosting, in: /etc/apache2/listen.conf uncomment the following line and save the file: NameVirtualHost *:80 Next, you want to create one file each for the two virtual hosts. You can put both vhosts in a single file but as I recall yast2 apache config tool may not work well with this, so just put them in a seperate file. copy the following for each domain: /etc/apache2/vhosts.d/vhost.template save each copy as: /etc/apache2/vhosts.d/example1.com.conf /etc/apache2/vhosts.d/example2.com.conf Now you can edit each file and change the directories and log locations to suit your needs. For the most part you'll just want to change the last part of the paths to the name of each domain e.g. /srv/www/vhosts/dummy-host.example.com becomes /srv/www/vhosts/example1.com It's sometimes easier to troubleshoot problems if each vhost has it's own error log. You can keep the same access log and use a tool to parse that. When you are done editing, enable apache2 to to start on boot, use the following based on which version of openSUSE you are running. insserv /etc/init.d/apache2 OR systemctl enable apache2.service Now restart apache to enable your vhost changes rcapache2 restart OR systemctl restart apache2.service Cheers the noo, Graham -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 17/08/12 20:56, Graham Anderson escribió:
On Friday 17 Aug 2012 18:37:33 Jim Flanagan wrote:
I'm sure this has been asked a thousand times, but how do I set up Apache to serve up 2 different pages for 2 different domains? Also I'm on a dynamic IP and have dyndns.org running fine for one domain. I suppose they can handle a second one to this domain, as long as I switch that domain over to them?
You want to enable name based virtual hosting, in:
/etc/apache2/listen.conf
uncomment the following line and save the file:
NameVirtualHost *:80
No, NameVirtualHost does nothing currently, it is ignored and emits a warning in apache 2.4 To Jim: read the following document, it will help you http://httpd.apache.org/docs/current/en/vhosts/examples.html ;-) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Cristian Rodríguez
-
Graham Anderson
-
James Knott
-
Jim Flanagan