• 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 207 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 (24.3K 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

  • Four Foolproof Tips To Never Run Out Of Blog Ideas For Your Website March 28, 2023
  • The Interactive Entertainment Serving as a Tech Proving Ground March 28, 2023
  • Is it Good to Run Apache Web server and MySQL Database on Separate Cloud Servers? March 27, 2023
  • Advantages of Cloud Server Over Dedicated Server for Hosting WordPress March 26, 2023
  • Get Audiophile-Grade Music on Your Smartphone March 25, 2023

About This Article

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

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

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

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

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT