0

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: https://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: http://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.

  • Please show your <virtualhost> configuration – Sander Steffann Jul 3 '14 at 21:14
  • Why do you not have the document root pointed at where the files actually are? This is the first obvious problem to fix. – Michael Hampton Jul 6 '14 at 14:07
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.