logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: apche does not follow path to file as defined in vhosts
Author
Ajje



Joined: 12 May 2015
Posts: 5
Location: Fiji, Lautoka

PostPosted: Wed 13 May '15 7:51    Post subject: apche does not follow path to file as defined in vhosts Reply with quote

For this test I did a system start on my Windows 7 PRO 64 bit Dell notebook.
My xampp download is xampp-win32-5.6.8-0-VC1-installer.exe this is not the latest version, I know, but it worked very fine until recently.

I cleared all apache log files

xampp-portcheck.exe shows that port 80 is already in use by apache.
My apache set up uses port 8080.
How come? Apache is not running.


Here is my apache setup:
c:/xampp/apache/conf/extra/http-vhosts.conf it shows only a few of my vhosts

#
# Virtual Hosts
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host configuration.
#
# Use name-based virtual hosting.
# http://goodnoniorg.local
#
NameVirtualHost 127.0.0.1:8080

<virtualhost 127.0.0.1:8080>
ServerName localhost
</virtualhost>

<VirtualHost 127.0.0.1>
DocumentRoot "c:/gks/testsites/nonimyst"
ServerName nonimystcom.local
ErrorLog "c:/gks/testsites/nonimyst/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/nonimyst/cgi-bin/"
<Directory "c:/gks/testsites/nonimyst">
# AllowOverride All
# Options ExecCGI +Includes
# Order deny,allow
Allow from all
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1>
DocumentRoot "c:/gks/testsites/goodnonibiz/htdocs"
ServerName goodnonibiz.local
ErrorLog "c:/gks/testsites/goodnonibiz/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/goodnonibiz/cgi-bin/"
AccessFileName ht.acl
<Directory "c:/gks/testsites/goodnonibiz">
AllowOverride All
Options ExecCGI +Includes
Order deny,allow
</Directory>
</VirtualHost>


in my system apache is set to Listen 8080

c:/windows/system32/dricers/etc/hosts looks like this (this is only part of it):

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 goodnonibiz.local
127.0.0.1 nonimystcom.local
::1 localhost
::1 nonimystcom.local
::1 goodnonibiz.local

started apache via xampp control panel:


looking at the apache error log:
[Wed May 13 17:07:13 2015] [notice] Digest: generating secret for digest authentication ...
[Wed May 13 17:07:13 2015] [notice] Digest: done
[Wed May 13 17:07:14 2015] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Wed May 13 17:07:14 2015] [notice] Server built: Nov 11 2009 14:29:03
[Wed May 13 17:07:14 2015] [notice] Parent: Created child process 6920
[Wed May 13 17:07:15 2015] [notice] Digest: generating secret for digest authentication ...
[Wed May 13 17:07:15 2015] [notice] Digest: done
[Wed May 13 17:07:15 2015] [notice] Child 6920: Child process is running
[Wed May 13 17:07:15 2015] [notice] Child 6920: Acquired the start mutex.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting 150 worker threads.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 443.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 8080.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 443.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 8080.

Why are there two start messages for apache?
Now I am trying to access the goodnonibiz.local server and enter this line
“http://localhost:8080/goodnonibiz.local” in the Firefox browser.

Here is what Firefox tells me:


This is what the apache error log looks like:


[Wed May 13 17:07:13 2015] [notice] Digest: generating secret for digest authentication ...
[Wed May 13 17:07:13 2015] [notice] Digest: done
[Wed May 13 17:07:14 2015] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Wed May 13 17:07:14 2015] [notice] Server built: Nov 11 2009 14:29:03
[Wed May 13 17:07:14 2015] [notice] Parent: Created child process 6920
[Wed May 13 17:07:15 2015] [notice] Digest: generating secret for digest authentication ...
[Wed May 13 17:07:15 2015] [notice] Digest: done
[Wed May 13 17:07:15 2015] [notice] Child 6920: Child process is running
[Wed May 13 17:07:15 2015] [notice] Child 6920: Acquired the start mutex.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting 150 worker threads.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 443.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 8080.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 443.
[Wed May 13 17:07:15 2015] [notice] Child 6920: Starting thread to listen on port 8080.
[Wed May 13 17:16:00 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/goodnonibiz.local
[Wed May 13 17:16:00 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/favicon.ico
[Wed May 13 17:16:00 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/favicon.ico

Why does apache not follow the path to my files as described in the VHOST?[img][/img][img][/img][img][/img]
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 13 May '15 8:40    Post subject: Reply with quote

http://localhost:8080/goodnonibiz.local

What your asking firefox to do is get the file goodnonibiz.local
on the host localhost.
Try http://goodnonibiz.local:8080 instead.
Back to top
Ajje



Joined: 12 May 2015
Posts: 5
Location: Fiji, Lautoka

PostPosted: Fri 15 May '15 19:37    Post subject: Reply with quote

I typed what you suggested in the firefox browser and received the XAMPP congratulation screen. The apache error log did not show any errors. My goodnonibiz.local was not there.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 15 May '15 21:00    Post subject: Reply with quote

oops, my bad. It's because you only have localhost configured for port 8000.

Change all your <VirtualHosts> to <VirtualHosts 127.0.0.1:8000>. Restart and it should work, maybe.

I've always used the documentroot in my first vhost that matched the one in httpd.conf and it has never failed. So in your case the first vhost would look like

<virtualhost 127.0.0.1:8080>
DocumentRoot "c:/xampp/htdocs"
</virtualhost>

Also, in these <VirtualHosts> since you are using Apache 2.4 it is best to use

Require all granted

instead of

Order deny,allow
Allow from all


The Order, Allow, Deny stuff is the old style of access control in Apache 2.0 & 2.2. You are able to use it i 2.4 because you have mod_access_compat.so loaded. However, if you mix and match these in your config, some will start to 403 on you.

It is best to simply not load mod_access_compat.so and it will then not allow the use of these and you will never run into the 403 surprise.
Back to top
Ajje



Joined: 12 May 2015
Posts: 5
Location: Fiji, Lautoka

PostPosted: Sat 16 May '15 5:00    Post subject: Reply with quote

Thanx!

I cleared log files then adjusted VHOSTS as you recommended:
NameVirtualHost 127.0.0.1:8080

<virtualhost 127.0.0.1:8080>
DocumentRoot "c:/xampp/htdocs"
</virtualhost>

<VirtualHost 127.0.0.1:8080>
DocumentRoot "c:/gks/testsites/nonimyst"
ServerName nonimyst.local
ErrorLog "c:/gks/testsites/nonimyst/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/nonimyst/cgi-bin/"
<Directory "c:/gks/testsites/nonimyst">
Require all granted
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
DocumentRoot "c:/gks/testsites/goodnonibiz/htdocs"
ServerName goodnonibiz.local
ErrorLog "c:/gks/testsites/goodnonibiz/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/goodnonibiz/cgi-bin/"
AccessFileName ht.acl
<Directory "c:/gks/testsites/goodnonibiz">
Require all granted
</Directory>
</VirtualHost>

Then started apche via xampp control
and entered this in Firefox:
http://localhost:8080/goodnonibiz.local

the result was this:
Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
16/05/2015 14:51:02
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1

Observation:
Task Manager did not show apache running
xamp control window showed apache has started.

After this test I stpped apache via xampp control window and copied the error log to here.
Error log had this content after stopping apache:
[Sat May 16 14:41:16 2015] [notice] Digest: generating secret for digest authentication ...
[Sat May 16 14:41:16 2015] [notice] Digest: done
[Sat May 16 14:41:16 2015] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Sat May 16 14:41:16 2015] [notice] Server built: Nov 11 2009 14:29:03
[Sat May 16 14:41:16 2015] [notice] Parent: Created child process 6316
[Sat May 16 14:41:18 2015] [notice] Digest: generating secret for digest authentication ...
[Sat May 16 14:41:18 2015] [notice] Digest: done
[Sat May 16 14:41:18 2015] [notice] Child 6316: Child process is running
[Sat May 16 14:41:18 2015] [notice] Child 6316: Acquired the start mutex.
[Sat May 16 14:41:18 2015] [notice] Child 6316: Starting 150 worker threads.
[Sat May 16 14:41:18 2015] [notice] Child 6316: Starting thread to listen on port 443.
[Sat May 16 14:41:18 2015] [notice] Child 6316: Starting thread to listen on port 443.
[Sat May 16 14:41:18 2015] [notice] Child 6316: Starting thread to listen on port 8080.
[Sat May 16 14:41:18 2015] [notice] Child 6316: Starting thread to listen on port 8080.
[Sat May 16 14:42:25 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/goodnonibiz.local
[Sat May 16 14:42:45 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/favicon.ico
[Sat May 16 14:42:45 2015] [error] [client ::1] File does not exist: C:/xampp/htdocs/favicon.ico
[Sat May 16 14:46:25 2015] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sat May 16 14:46:25 2015] [notice] Child 6316: Exit event signaled. Child process is ending.
[Sat May 16 14:46:26 2015] [notice] Child 6316: Released the start mutex
[Sat May 16 14:46:27 2015] [notice] Child 6316: All worker threads have exited.
[Sat May 16 14:46:27 2015] [notice] Child 6316: Child process is exiting
[Sat May 16 14:46:27 2015] [notice] Parent: Child process exited successfully.

What is wrong???
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sat 16 May '15 8:01    Post subject: Reply with quote

You obviously have an older Xampp intalled on your computer.

[Sat May 16 14:41:16 2015] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured

This is certainly not xampp 5.6.8 as you stated in your original post. This is more like Xampp 1.5.x or 1.6.x.

Xampp 5.6.8 has Apache 2.4.12, OpenSSL 1.0.1l, PHP 5.6.8 in it.

You need to get rid on the old xampp. Xampp is not easy to upgrade either.

And you can not do this regardless
http://localhost:8080/goodnonibiz.local

URLs are like so
http://hostname:port/filepath

goodnonibiz.local IS A hostname, not a filepath.
Back to top
Ajje



Joined: 12 May 2015
Posts: 5
Location: Fiji, Lautoka

PostPosted: Sun 17 May '15 10:37    Post subject: Reply with quote

I followed your advise and installed the latest xampp and apache Then i did the same tests as before, here is what happened:

First updated the HOSTS file:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
downloaded and installed latest XAMPp on Windows 7 pro 64 bit.
made 2 changes to http.conf"
Listen *:8080
ServerName localhost:8080

this is part of the the hosts file:
127.0.0.1 localhost
::1 localhost
127.0.0.1 goodnonibiz.local
::1 goodnonibiz.local
127.0.0.1 nonimyst.local
::1 nonimyst.local

this is the vhosts file:

<virtualhost 127.0.0.1:8080>
DocumentRoot "c:/xampp/htdocs"
</virtualhost>

<VirtualHost 127.0.0.1:8080>
DocumentRoot "c:/gks/testsites/nonimyst"
ServerName nonimyst.local
ErrorLog "c:/gks/testsites/nonimyst/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/nonimyst/cgi-bin/"
<Directory "c:/gks/testsites/nonimyst">
Require all granted
</Directory>
</VirtualHost>

<VirtualHost 127.0.0.1:8080>
DocumentRoot "c:/gks/testsites/goodnonibiz/htdocs"
ServerName goodnonibiz.local
ErrorLog "c:/gks/testsites/goodnonibiz/logs/errorlog.txt"
ScriptAlias /cgi-bin/ "c:/gks/testsites/goodnonibiz/cgi-bin/"
AccessFileName ht.acl
<Directory "c:/gks/testsites/goodnonibiz">
Require all granted
</Directory>
</VirtualHost>

then starterted apache via xampp control panel: no errors, clean start.

using internet explorer:
http://localhost:8080/xampp/ this brings the XAMPP splash screen
http://localhost:8080/nonimyst.local this brings
OBJECT NOT FOUND ...... ERROR 404
localhost
Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8

stopped apache via XAMPP control

this is the apache error log after stopping:

[Sun May 17 20:03:38.948406 2015] [ssl:warn] [pid 1048:tid 360] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun May 17 20:03:38.998407 2015] [core:warn] [pid 1048:tid 360] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sun May 17 20:03:39.198407 2015] [ssl:warn] [pid 1048:tid 360] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun May 17 20:03:39.228407 2015] [mpm_winnt:notice] [pid 1048:tid 360] AH00455: Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8 configured -- resuming normal operations
[Sun May 17 20:03:39.228407 2015] [mpm_winnt:notice] [pid 1048:tid 360] AH00456: Apache Lounge VC11 Server built: Jan 28 2015 16:48:40
[Sun May 17 20:03:39.228407 2015] [core:notice] [pid 1048:tid 360] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Sun May 17 20:03:39.228407 2015] [mpm_winnt:notice] [pid 1048:tid 360] AH00418: Parent: Created child process 7680
[Sun May 17 20:03:39.808408 2015] [ssl:warn] [pid 7680:tid 372] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun May 17 20:03:40.008408 2015] [ssl:warn] [pid 7680:tid 372] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Sun May 17 20:03:40.038408 2015] [mpm_winnt:notice] [pid 7680:tid 372] AH00354: Child: Starting 150 worker threads.

the log does not show that apapched stopped.

the xampp control window shows:
[Apache] Attempting to start Apache app...
20:03:38 [Apache] Status change detected: running
20:08:06 [Apache] Attempting to stop Apache (PID: 1048)
20:08:06 [Apache] Attempting to stop Apache (PID: 7680)
20:08:07 [Apache] Status change detected: stopped

Task manager did no longer show the apache PID's

Somehow the link between server name (hosts) and document root (vhosts) is not alive.
I thought the vhosts specifications override the specifications in the http.conf ?
My apache set up with vhosts was running fine until port 80 became unavailable for some reason.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 17 May '15 20:51    Post subject: Reply with quote

Sorry if I sound snippy but for the third time now, this is not a URL that is going to work;

http://localhost:8080/nonimyst.local

This will ALWAYS go to c:/xampp/htdocs/nonimyst.local because localhost is the actual hostname in that url. You want to use http://nonimyst.local and http://goodnonibiz.local

Something else that I noticed is in the windows hosts file you are using both 127.0.0.1 and ipv6 ::1, but you are locking your VirtualHosts down to 127.0.0.1 only. Being that the IPv6 address is after the IPv4 address in windows hosts file it will probably be used and therefor those VirtualHosts will not be picked up and Apache will serve the only host it knows is allowed to server on that IPv6 address, the one in httpd.conf.

So, either remove
::1 goodnonibiz.local
::1 nonimyst.local
from the hosts file or
change the all the VirtualHosts to

<virtualhost *:8080>

That way they will bind to 127.0.0.1 and ::1 as well as your LAN IP.
Back to top
Ajje



Joined: 12 May 2015
Posts: 5
Location: Fiji, Lautoka

PostPosted: Mon 18 May '15 8:15    Post subject: Reply with quote

Thanx,
I did the changes you suggested to hosts, I removed all ::1 ..... lines
and saved it. hosts looks like this now:
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 goodnonibiz.local
127.0.0.1 nonimyst.local
127.0.0.1 herbexinfo.local

After this I did httpd -S and found that nonimyst.local and goodnonibiz.local are there but the directories are always the same for localhost anad nonimyst.local and goodnonibiz.local it shows
port 8080 namevhost nonimyst.local (c:/xampp/apache/conf/extra/httpd-vhosts.conf:53)
After starting apache via xamp control I entered
http://nonimyst.local in Firefox and the answer was:
Not Found
HTTP Error 404. The requested resource is not found.
Then I entered
http://localhost:8080/nonimyst.local and got this:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.6.8

And, hey, I don't mind you sounding snippy.

I have now installed Apache 2.4.10 on a new Windows 8.1 machine using hosts from my W 7 and copied the vhost from the W 7 to the W 8.1 machine, also copied all web sites to the new machine.
When browsing any of them, I get the same old 404 error and Object not found.
I am checking httpd.conf and vhosts.conf but can not find any clues. There must be something which prevents apache to follow the absolute path to the vhosts.
Back to top


Reply to topic   Topic: apche does not follow path to file as defined in vhosts View previous topic :: View next topic
Post new topic   Forum Index -> Apache