Mobile app version of vmapp.org
Login or Join
Vandalay111

: Only IPv6 errors in apache error "file does not exist" (while the file exist in IPv4) Situation: VPS with Apache, multiple websites. Document root is /var/www/html but nothing can be found there

@Vandalay111

Posted in: #Apache #Ipv6

Situation:
VPS with Apache, multiple websites.
Document root is /var/www/html but nothing can be found there because the files of the websites are found in /domains/mywebsite.com/public_html/

Problem:
I'm getting "file does not exist" errors in the Apache error log and they are always related to clients with an IPv6 address. No errors are shown with an IPv4 (except for the regular hack's on pages that don't exist on my VPS).
The files that can't be found are most of the times existing webpages on one of my websites.

Analysis:
I have visited my own webpages with a web browser that the errors are referring to but no problems occur and no extra error log in my Apache error log while I'm visiting those pages (and I use a IPv4 address).

Example 1:
[client ---IPv6 address---] file does not exist: /var/www/html/specificwebpage, referrer: www.google.be/
The "specific webpage" is one of my webpages of one of my sites (and is rewritten by .htaccess to specificwebpage.php).

Example 2:
[client ---IPv6 address---] file does not exist: /var/www/html/css, referrer: mywebsite.com/subdirectory/
When I visit this webpage (its rewritten by .htaccess to subdirectory/index.php) then there are no error seen in my browser and no extra error log line in the Apache log.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Vandalay111

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini213

Remember that whenever configuring anything for IPv6 in Apache, all IPv6 addreses must be specified in square brackets since otherwise the optional port number couldn't be determined.

Ensure in your httpd.conf file that you have a Listen statement present for both your IPv4 and IPv6 addresses, for example:

Listen 12.34.56.78:80
Listen [2001:db8::a00:20ff:fea7:ccea]:80


For each website hosted on the VPS you'll also need an IPv4 specific VirtualHost declaration and an IPv6 specific VirtualHost declaration, for example:

<VirtualHost 12.34.56.78:80>
ServerAdmin webmaster@mywebsite.com
DocumentRoot /domains/mywebsite.com/public_html
ServerName mywebsite.com
ErrorLog /var/etc/logs/mywebsite.com/error_log_ipv4
TransferLog /var/etc/logs/mywebsite.com/access_log_ipv4
</VirtualHost>

<VirtualHost [2001:db8::a00:20ff:fea7:ccea]:80>
ServerAdmin webmaster@mywebsite.com
DocumentRoot /domains/mywebsite.com/public_html
ServerName mywebsite.com
ErrorLog /var/etc/logs/mywebsite.com/error_log_ipv4
TransferLog /var/etc/logs/mywebsite.com/access_log_ipv4
</VirtualHost>


As a helpful tip I've often found it useful to specify different log files for your IPv4 and IPv6 connections since this makes troubleshooting a lot simpler, especially on high-traffic websites.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme