Multiple IPs and Apache Virtual Hosting
I have two IP addresses and a bunch of domains. One domain I'm going to be using for ecommerce with SSL and is my primary domain. I want this domain to have its own unique IP address.
I have about 7 other domains that I want to share the same secondary IP address.
I've tried a few things but botched the whole thing. I've reverted everything back to the standard way of doing things.
On Ubuntu 11 here.
<virtualhost *:80="">ServerAdmin admin@domain1.com
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/www/domain1.com
<directory>Options FollowSymLinks
AllowOverride None</directory>
<directory var="" www="" domain1.com="">Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all</directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<directory "="" usr="" lib="" cgi-bin"="">AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all</directory></virtualhost>
That's what my current setup looks like for every site. I haven't set up the second IP on my server yet either.
3 Replies
ssl ip address
Listen 1.2.3.4:443
other domains ip address
Listen 5.6.7.8:80
NameVirtualHost 1.2.3.4:443
NameVirtualHost 5.6.7.8:80
SSLEngine on etc
etc
If you wanted the SSL site to also be on port 80, you'd have to add another Listen, NameVirtualHost and VirtualHost tag for 1.2.3.4:80
# ssl ip address
Listen 1.2.3.4:443
# other domains ip address
Listen 5.6.7.8:80
NameVirtualHost 1.2.3.4:443
NameVirtualHost 5.6.7.8:80
?
I have all my configs for each site in sites-available and sites-enabled.
ls /etc/apache2/sites-enabled
domain1.com
domain1.net
domain2.com
domain2.net
domain3.com
domain3.net
domain4.com
domain4.net
domain4.org