Configuring the IPv6 with this blog :)

· 3 min read

So, after reading several websites which now IPv6 enable, I would like to make this blog IPv6 enable too… :p
First case is, I can run this blog under IPv6 with BuyVM without problem. Buy with another host, I always have a problem. But thank’s to the LET, when I post a thread about this issues, Mr. Salvatore from Prometeus/Iperweb comes with a suggestion.
When I’m running this blog with Ubuntu 10.04, I can run without problem with BuyVM, but with another host, with the same Ubuntu 10.04, and the same configuration for PHP and Lighttpd, I always facing issues. So I decided to try another OS, Ubuntu 11.10 32 bit with VPS from Prometeus/Iperweb.
By using Ubuntu 11.10, we get Lightpd 1.4.28.
And the configuration is a bit different from Ubuntu 10.04 / Lighttpd 1.4.26.
So, here is the steps I take to make this blog running under Ubuntu 11.10 :

  • Create a backup of WordPress directory and database at another VPS
  • Fresh Installation of Ubuntu 11.10 VPS
  • Update / Upgrade, and removing unneeded packages :
    # apt-get -y update && apt-get -y upgrade && service apache2 stop && apt-get -y remove apache2 && apt-get -y remove portmap && apt-get -y remove bind9 && apt-get -y remove samba && rm -rf /usr/sbin/apache2
  • Installing needed component to run as a Webserver:
    # apt-get install -y nano squid openvpn gcc c++ g++ lighttpd mysql-server php5-cgi php5-mysql php5-gd php5-curl php5-imagick php5-memcache php5-xcache zip
  • Download the backup file and databases :
    # wget www.backupserver.com/backup.sql && wget www.backupserver.com/backup.tar.gz
  • Copying the files to the webdir and extract it :
    cp /root/backup.tar.gz /var/www && cd /var/www && tar xf backup.tar.gz
  • Creating Databases and Import the backup database to the system :
    # mysql -u root -p
     Insert the MySQL password for root...
    mysql> create database database_name;
    mysql> grant usage on *.* to database_user@localhost identified by 'database_password';
    mysql> grant all privileges on database_name.* to database_user@localhost;
    mysql> flush privileges;
    mysql> exit;
    # mysql -u database_user --password=database_password database_name < /root/backup.sql
  • Configure the Lighttpd 1.4.28 to work with IPv6 :
    # nano /etc/lighttpd/lightpd.conf
    server.modules = (
    	"mod_access",
    	"mod_alias",
    	"mod_compress",
     	"mod_redirect",
          "mod_rewrite"
    )
    server.document-root        = "/var/www"
    server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
    server.errorlog             = "/var/log/lighttpd/error.log"
    server.pid-file             = "/var/run/lighttpd.pid"
    server.username             = "www-data"
    server.groupname            = "www-data"
    index-file.names            = ( "index.php", "index.html",
                                    "index.htm", "default.htm",
                                   "index.lighttpd.html" )
    url.access-deny             = ( "~", ".inc" )
    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
    ## Use ipv6 if available
    #server.bind = "[::]"
    include_shell "/usr/share/lighttpd/use-ipv6.pl"
    dir-listing.encoding        = "utf-8"
    server.dir-listing          = "enable"
    compress.cache-dir          = "/var/cache/lighttpd/compress/"
    compress.filetype           = ( "application/x-javascript", "text/css", "text/html", "text/plain" )
    include_shell "/usr/share/lighttpd/create-mime.assign.pl"
    include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
  • Configuring the simple-vhost :
    # nano /etc/lighttpd/conf-enabled/10-simple-vhost
    # /usr/share/doc/lighttpd-doc/simple-vhost.txt
    server.modules += ( "mod_simple_vhost" )
    ## The document root of a virtual host is document-root =
    ##   simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
    simple-vhost.server-root         = "/var/www"
    simple-vhost.document-root       = "html"
    ## the default host if no host is sent
    simple-vhost.default-host        = "www.example.com"
  • Enabling fastcgi and fastcgi-php in Lighttpd:
    # lighttpd-enable-mod fastcgi
    # /etc/init.d/lighttpd force-reload
    # lighttpd-enable-mod fastcgi-php
    # /etc/init.d/lighttpd force-reload

    Do remember that php-cgi is running 4 child by default, so it might eat some memory. You can tweak it by changing it :

    # nano nano /etc/lighttpd/conf-enabled/15-fastcgi-php
    # /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
    # http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_fastcgi-fastcgi
    ## Start an FastCGI server for php (needs the php5-cgi package)
    fastcgi.server += ( ".php" =>
    	((
    		"bin-path" => "/usr/bin/php-cgi",
    		"socket" => "/tmp/php.socket",
    		"max-procs" => 1,
    		"bin-environment" => (
    			"PHP_FCGI_CHILDREN" => "1",
    			"PHP_FCGI_MAX_REQUESTS" => "1000"
    		),
    		"bin-copy-environment" => (
    			"PATH", "SHELL", "USER"
    		),
    		"broken-scriptfilename" => "enable"
    	))
    )
  • Restart the Lighttpd :
    # service lighttpd restart
  • Reducing MySQL by disabling innodb