Multiple IPs and Apache Virtual Hosting

OK.

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

Did you try something like this?

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

ServerName ssl_domain

SSLEngine on etc

ServerName first_domain

ServerName second_domain

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

Where do I put:

# 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

listen and namevirtualhost go in the ports.conf file in/etc/apache2

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct