• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Apache2 IPv6 Virtual Host Configuration (Ubuntu Server)

By Abhishek Ghosh September 7, 2018 3:53 pm Updated on September 7, 2018

Apache2 IPv6 Virtual Host Configuration (Ubuntu Server)

Advertisement

Most Important Part of Apache Web Server is Virtual Host. Commonly we show IPv4 configuration for the beginners. Here is Apache2 IPv6 Virtual Host Configuration For Ubuntu Server. For this guide, we are assuming that the readers are using Ubuntu 16.04 or Ubuntu 18.04 and has followed our guide to install Apache on Ubuntu 18.04. Our guide is different from gross guides on web as we use Ondřej Surý’s PPA and assume that the readers using SSL/TLS with HSTS.

 

Sample Apache2 IPv6 Virtual Host Configuration For Ubuntu Server

 

Update and upgrade Ubuntu :

Vim
1
2
apt update -y
apt upgrade -y

In case, you have not installed Apache2, then install it after adding Ondřej Surý’s PPA :

Advertisement

---

Vim
1
2
3
4
5
6
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/apache2
# hit enter/return key to accept
apt update -y
apt upgrade -y
sudo apt install apache2

Normally we activate these modules and restart Apache :

Vim
1
2
3
4
5
6
a2enmod http2
systemctl restart apache2
a2enmod ssl
systemctl restart apache2
a2ensite default-ssl
systemctl restart apache2

Normally for IPv6 we go to /etc/apache2/sites-available/ and check the files :

Vim
1
2
cd /etc/apache2/sites-available/
ls -al

Usually there are two files – 000-default.conf and default-ssl.conf. For IPv4 we edit them. Apache’s another important file is :

Vim
1
/etc/apache2/apache2.conf

We have to check for Listen directive. We can cat and grep the two files to check Listen directive :

Vim
1
2
3
cat /etc/apache2/apache2.conf | grep "Listen"
cat /etc/apache2/sites-available/000-default.conf | grep "Listen"
cat /etc/apache2/sites-available/default-ssl.conf | grep "Listen"

We can check which ports and type of IP our Apache is listening by running :

Vim
1
netstat -lnptu |grep "apache2\W*$"

That will return output like this :

Vim
1
2
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4889/apache2
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4889/apache2

Apache2 IPv6 Virtual Host Configuration Ubuntu Server

That means Apache is not listening to IPv6. It is listening only to port 80 and port 443 of IPv4.

Usually by default there is no Listen directive. Instead we write in this way in /etc/apache2/sites-available/default-ssl.conf file :

Vim
1
2
3
4
5
6
7
8
<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@thecustomizewindows.com
 
                DocumentRoot /var/www/html
                ErrorLog ${APACHE_LOG_DIR}/error.log
...
...

The string _default_ is used with IP virtual hosting to catch unmatched IP addresses. That is good for IPv4 but for IPv6 we need to mention single specific IP for a particular site, otherwise it will open wide door to the script kiddies. IPv6 has special considerations, which are mentioned on official documentation :

Vim
1
https://httpd.apache.org/docs/2.4/bind.html#ipv6

That default virtual host example configuration above need to be changed. If our IPv4 is 12.13.14.15 and IPv6 selected is fd13:01ec:a560:534f::50, then we can add listen directive to both ports for both IPv4 and IPv6 :

Vim
1
2
3
4
Listen [fd13:01ec:a560:534f::50]:80
Listen [fd13:01ec:a560:534f::50]:443
Listen 12.13.14.15:80
Listen 12.13.14.15:443

We can add the above stanza to /etc/apache2/apache2.conf file. If we add Listen directive to virtual host file like :

Vim
1
cat /etc/apache2/sites-available/default-ssl.conf

That becomes complex to maintain with just one site on server. It becomes highly complicated for 4+ virtual host files on the server.

And we will write the virtual host files (like /etc/apache2/sites-available/default-ssl.conf) in this way :

/etc/apache2/sites-available/default-ssl.conf
Vim
1
2
3
4
5
6
7
8
<IfModule mod_ssl.c>
        <VirtualHost [fd13:01ec:a560:534f::50]:443 12.13.14.15:443>
                ServerAdmin webmaster@thecustomizewindows.com
 
                DocumentRoot /var/www/html
                ErrorLog ${APACHE_LOG_DIR}/error.log
...
...

Then we can do a config test :

Vim
1
sudo apache2ctl configtest

The above system of configuration will decrease the headache during maintenance. Thereafter we can restart Apache :

Vim
1
service apache2 restart

Then check what Apache is listening to :

Vim
1
netstat -lnptu |grep "apache2\W*$"

We will get something like :

Vim
1
tcp        0      0 fd13:01ec:a560:534f::50:443     :::*                        LISTEN      4473/apache2

 

Conclusion

 

For IPv6, we need to determine the specific IP we are going to use. Then add Listen directive to /etc/apache2/apache2.conf file. Then edit virtual host files like /etc/apache2/sites-available/default-ssl.conf. With all default settings, your server may respond to a specific IPv6 address, but that technically not perfect for various reasons.

Tagged With apache2 ipv6 , apache 2 bind ipv6 address , apache ipv6 konfigurieren ubuntu 18 04 , apache ipv6 virtual host in ubuntu , apache2 ipv6 listen , cd /etc/apache2/sites-available/ , ipv6 apache ubuntu , ubuntui apache2 listen to ipv6 and ipv4 , websites on apache server uses ipv6

This Article Has Been Shared 424 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Apache2 IPv6 Virtual Host Configuration (Ubuntu Server)

  • How to Upload Backup to Dropbox from Cloud Server

    Here is How to Upload Backup to Dropbox from Cloud Server in Case You Want To Keep Your Backup of Files and Database on a Free Cloud Storage.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • Top Reasons Why Cloud Server Sucks Your Bucks

    Public Cloud is Deceptive From Sysadmin’s Point of View When Usage of RAM is More. Here Are Top Reasons Why Cloud Server Sucks Your Bucks.

  • How To Perform Security Audits On Ubuntu 16.04 (With Lynis)

    Here Is How To Perform Security Audits On Ubuntu 16.04 With Lynis And Other Tools Which Are Appropriate On Cloud Server’s Shared Environment.

  • How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS

    rsnapshot Once Set, Can Automatically Incrementally Backup. Here is How To Set Up rsnapshot For Backup Of WordPress on Cloud Server/VPS.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • The Cost of Doing Business as a Handyman July 1, 2022
  • Samsung Galaxy S22 Ultra: Long Term Review June 30, 2022
  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022
  • Safe Chargers for Samsung Galaxy S22 Ultra June 27, 2022
  • How Telecoms Can Use The Cloud To Power Their 5G Network June 24, 2022

About This Article

Cite this article as: Abhishek Ghosh, "Apache2 IPv6 Virtual Host Configuration (Ubuntu Server)," in The Customize Windows, September 7, 2018, July 1, 2022, https://thecustomizewindows.com/2018/09/apache2-ipv6-virtual-host-configuration-ubuntu-server/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy