How to enable ipv4 and ipv6 in same domain on apache2
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
<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
To someone who actually has experience with this, is everything I've done correct?~~
2600:3c00::f03c:91ff:80
So…it looks like yours is working fine.