How to enable ipv4 and ipv6 in same domain on apache2

I run debian6 and apache2.I want use ipv4 and ipv6 on single site.

For example,I have abc.me domain.I want abc.me links ipv4 & ipv6.I have set abc.me apache file.

/etc/apache2/sites-available/abc.me

 <virtualhost *:80="">ServerAdmin admin@abc.me
     ServerName abc.me
     ServerAlias abc.me
     DocumentRoot /home/public/
       <directory home="" public="">Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all</directory> 
     ErrorLog /home/logs/error.log
     CustomLog /home/logs/access.log combined</virtualhost> 

2 Replies

I just finished setting up ipv6. After quite a bit of searching around, I hope I got it right! Documentation for doing most stuff with ipv6 sucks, so it's hard to tell if what I'm doing is correct (and if so, am I doing it optimally?).

 <virtualhost 173.255.198.65:80="" [2600:3c00::f03c:91ff:fe93:824a]:80="">ServerAdmin a@abc.com
    ServerName fangsoft.net
    ServerAlias www.fangsoft.net
    DocumentRoot /srv/www/fangsoft.net/public_html/
    ErrorLog /srv/www/fangsoft.net/logs/error.log
    CustomLog /srv/www/fangsoft.net/logs/access.log combined</virtualhost> 

#gotta split up fangsoft.net and www.fangsoft.net because a wildcard in the CN field of a cert doesn't apply to the root domain
#CN=*.fangsoft.net works for www.fangsoft.net and proxy.fangsoft.net but not fangsoft.net
 <virtualhost 173.255.198.65:443="" [2600:3c00::f03c:91ff:fe93:824a]:443="">ServerAdmin a@abc.com
    ServerName fangsoft.net
    DocumentRoot /srv/www/fangsoft.net/public_html/
    ErrorLog /srv/www/fangsoft.net/logs/error.log
    CustomLog /srv/www/fangsoft.net/logs/access.log combined

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/fangsoft.net.pem
    SSLCertificateKeyFile /etc/apache2/ssl/fangsoft.net.key</virtualhost> 

 <virtualhost 173.255.198.65:443="" [2600:3c00::f03c:91ff:fe93:824a]:443="">ServerAdmin a@abc.com
    ServerName www.fangsoft.net
    DocumentRoot /srv/www/fangsoft.net/public_html/
    ErrorLog /srv/www/fangsoft.net/logs/error.log
    CustomLog /srv/www/fangsoft.net/logs/access.log combined

    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/subdomain.fangsoft.net.pem
    SSLCertificateKeyFile /etc/apache2/ssl/subdomain.fangsoft.net.key</virtualhost> 

Also, you need to change your ports.conf so apache listens correctly:

NameVirtualHost 173.255.198.65:80
NameVirtualHost [2600:3c00::f03c:91ff:fe93:824a]:80
Listen 80

 <ifmodule mod_ssl.c=""># If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <virtualhost *:443=""># Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    NameVirtualHost 173.255.198.65:443
    NameVirtualHost [2600:3c00::f03c:91ff:fe93:824a]:443
    Listen 443</virtualhost></ifmodule> 

 <ifmodule mod_gnutls.c="">Listen 443</ifmodule> 

And don't forget to add AAAA entries for every A entry in the DNS manager (I did this correctly, right?):

~~![](<URL url=)http://i.imgur.com/3zK91.png" />

It's working (when I reload apache, it doesn't spit out any errors or warnings, and I can visit my site without any issues). My site (and all relevant subdomains) pass this test. Unfortunately, I don't personally have ipv6, so I have no idea how to actually test if it works in practice.

To someone who actually has experience with this, is everything I've done correct?~~

You can test IPv6 if you set up an SSH tunnel through your Linode (at least I can, from Fremont). Since you're in Dallas you should be able to do it as well. Your site works fine for me, and it looks like I'm connecting via IPv6. netstat truncates the output, but yours is the only IPv6 site I'm browsing and it does show:

2600:3c00::f03c:91ff:80

So…it looks like yours is working fine.

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