Wednesday, November 05, 2014

Ipv6 localhost Apache setup

#Just a sample ipv6 config:
# ::1 is like 127.0.0.1<
# when you restart apache, see if apache is listening on ipv6
#  sudo netstat -ntlpu
# If not, you may need to make sure eth0 is listening on an ipv6 address
#  sudo ifconfig eth0 add 1::2
# 

<VirtualHost [::1]:80>
    ServerName ipv6
    ServerAlias ipv6.mydomain.com
    DocumentRoot "/var/www/ipv6.mydomain.com"
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory />
        Options -Indexes +FollowSymLinks -Multiviews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

<VirtualHost [::1]:443>
    ServerName ipv6
    ServerAlias ipv6.mydomain.com

    DocumentRoot "/var/www/ipv6.mydomain.com"
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory />
        Options -Indexes FollowSymLinks -MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

    Include standard_ssl.inc

    SSLCertificateFile ssl/local.mydomain.com.pem
    SSLCertificateChainFile ssl/DigiCertHighAssuranceCA-3.crt

</VirtualHost>


#sources:
# https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/633981
# http://serverfault.com/questions/81508/listening-for-both-ipv6-and-ipv4-in-apache-2-2
# http://unix.stackexchange.com/questions/106502/apache2-does-not-run-on-ipv4-tcp-port
# http://www.fix6.net/archives/2011/02/04/how-to-enable-ipv6-on-apache2/