Author |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Fri 23 Mar '12 16:46 Post subject: problem with vhosts |
|
|
I don't know the language and spent hours getting this far. I do know about paths
Page will not load.
vhosts enabled.
All my local sites are g:/xxx ,not G:/wamp/www
vhost file:
NameVirtualHost *:80
<VirtualHost *:80 >
DocumentRoot "g:/wamp/www"
ServerName 127.0.0.1
ServerAlias Localhost
</VirtualHost>
<VirtualHost *:80 >
DocumentRoot "g:/skip"
ServerName skip
ServerAlias skip
<Directory "g:/skip/">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from skip
</Directory>
</VirtualHost>
Erroe from Apach log
[Fri Mar 23 09:44:47 2012] [error] [client 127.0.0.1] File does not exist:
G:/wamp/www/index.html
I can't figure out why " wamp/www/" is in the path.
Thanks to all who help. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Sat 24 Mar '12 13:14 Post subject: |
|
|
Which url do you open in your browser?
you have to open http://skip/ to see the disired file cause you named the vhost that. |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Sat 24 Mar '12 15:00 Post subject: |
|
|
Thanks for responding.
http://skip takes me to skip.com an external website. - no relation to me.
http://skip.localhost which gives me the PHP configuration screen. http://skip.localhost/mypage/php gives me a page indicating it's reading PHP
You missed the main point about "wamp/www" in the path in Apache error log |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 26 Mar '12 23:02 Post subject: |
|
|
http://skip.localhost <---> ServerName skip
That does not match Since the localhost is the first host, apache takes that one if no ServerName matches with the requested host. |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Tue 27 Mar '12 1:40 Post subject: |
|
|
I moved 127.0.0.1 localhost to bottom of host file.
Samo |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Tue 27 Mar '12 11:20 Post subject: |
|
|
That is not what I meant.
use
Code: |
ServerName skip.localhost
|
|
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Tue 27 Mar '12 14:32 Post subject: |
|
|
Thanks for your persistant help.
changed it as you said. No change! |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 29 Mar '12 10:04 Post subject: |
|
|
Ok ....
did you define the vhosts in an extra file, if yes do you realy include that file into httpd.conf? If yes the vhosts with its names must be shown with httpd -S on the console. |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Sun 01 Apr '12 0:31 Post subject: |
|
|
When I go to console mode it asks for password. I type what I think it is and the window closes. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 04 Apr '12 11:49 Post subject: |
|
|
rob62 wrote: | When I go to console mode it asks for password. I type what I think it is and the window closes. |
How did you install apache? Running apache as a different user? Installed as a service? |
|
Back to top |
|
Triple_Nothing
Joined: 01 Apr 2012 Posts: 39 Location: WI, USA
|
Posted: Wed 04 Apr '12 22:48 Post subject: |
|
|
Are you aiming to run this local? As far as a basic example of a vhost entry, I use this for my users' default directory:
Code: | <VirtualHost *:80>
ServerName users.hellzoneinc.com
ServerAlias www.users.hellzoneinc.com
DocumentRoot "C:/Program Files (x86)/Apache2/htdocs"
</VirtualHost> |
and this for my main root site:
Code: | <VirtualHost *:80>
ServerName www.hellzoneinc.com
ServerAlias hellzoneinc.com
DocumentRoot "C:/Program Files (x86)/Apache2/htdocs/triple_nothing/hellzoneinc.com/www"
ErrorLog "logs/hellzoneinc.com-error.log"
CustomLog "logs/hellzoneinc.com-access.log" common
</VirtualHost> |
So in the end:
Code: | <VirtualHost *:80>
ServerName {Address to this directory}
ServerAlias {Alias} (Also known as, n such)
DocumentRoot "{Directory you wish this address to point to}"
</VirtualHost> |
Hope this maybe helps. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Thu 05 Apr '12 1:31 Post subject: |
|
|
The biggest problem for people just starting out using virtual hosts is that they do not see (or understand) something in the docs, mainly the first vhost MUST be a duplicate of the main host. There is also the _default_ host.
So if in httpd.conf you have
ServerName localhost
DocumentRoot C:/Apache2x/htdocs
The the first thing in httpd-vhosts.conf
<VirtualHost _default_:port>
# ServerName is not needed here
DocumentRoot C:/Apache2x/htdocs
</VirtualHost>
<VirtualHost *:port>
ServerName www.whatever.com
DocumentRoot C:/path/to/whatever/site
...
</VirtualHost>
<VirtualHost *:port>
ServerName www.someother.com
DocumentRoot C:/path/to/someother/site
...
</VirtualHost>
and on and on. And if one uses httpd-vhosts.conf, make sure it is included from httpd.conf
Include conf/extra/httpd-vhosts.conf
Now, the default host, even if you do not use _default_ it still does same. It will be the one to answer anything pointing to your IP that does not match any configured ServerName on the server, even a http://xxx.xxx.xxx.xxx IP based URL. This is why it doesn't matter if there is a Servername or not in the first one. |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Thu 05 Apr '12 23:45 Post subject: |
|
|
Ok ....
did you define the vhosts in an extra file, if yes do you realy
include that file into httpd.conf? If yes the vhosts with its
names must be shown with httpd -S on the console.
mysql> -s gives me ->
****************************
Enabled in httpd.conf:
Include conf/extra/httpd-vhosts.conf
last line in httpd.conf is:
Include "g:/wamp/alias/*"
httpd-vhosts.conf is:
NameVirtualHost *:80
<virtualHost *:80 >
DocumentRoot g:/wamp/www
</virtualHost>
Gives apache erroe:
[Thu Apr 05 16:33:59 2012] [error] (OS 11001)No such host is known. : Could not resolve host name *:80> -- ignoring!
[Thu Apr 05 16:33:59 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Thu Apr 05 16:33:59 2012] [notice] Child 7640: Child process is running
[Thu Apr 05 16:33:59 2012] [notice] Child 7640: Acquired the start mutex.
[Thu Apr 05 16:33:59 2012] [notice] Child 7640: Starting 64 worker threads.
[Thu Apr 05 16:33:59 2012] [notice] Child 7640: Starting thread to listen on port 80.
[Thu Apr 05 16:33:59 2012] [notice] Child 7640: Starting thread to listen on port 80.
http://skip gives me the server configuration screen.
http://www/php_test.php
The requested URL /php_test.php was not found on this server. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 06 Apr '12 3:26 Post subject: |
|
|
Q: did you define the vhosts in an extra file
A: I do not know, did you?
Q: if yes do you really include that file into httpd.conf?
A: you betcha, otherwise Apache will not read it at start up.
Statement: If yes the vhosts with its names must be shown with httpd -S on the console.
Reply: Cool, looks like it should, isn't doing it in 2.4.2.
but you are in the mysql prompt on your example,
so what mysql> -s gives you has nothing to do with this.
-------------------------------------------------
ok, I am assuming here that the main hosts document root in httpd.conf is g:/wamp/www (just the default test page and let's not worry about that right now.)
Assuming the above to be true, in httpd.conf
Include conf/extra/httpd-vhosts.conf
You have already done this I believe
In conf/extra/httpd-vhosts.conf
Code: | <VirtualHost *:80>
DocumentRoot "g:/wamp/www"
</VirtualHost>
<VirtualHost *:80 >
DocumentRoot "g:/skip"
ServerName skip
<Directory "g:/skip">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost> |
Now, provided that, and skip is defined in WIndows host file, http://skip out to go to whatever is in g:/skip |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Fri 06 Apr '12 4:55 Post subject: |
|
|
Yes, this is configure as a local server. for testing.
httpd-Vhosts.conf is a separate file.
"DocumentRoot C:/Apache2x/htdocs"
I do not have that. I'm assuming that
DocumentRoot g:/wamp/www is the same. Different flavor of Apache
Because of this I think it's best to include the file, httpd.conf
http:/skip gives me "skip" with the configuration screen.
Http://skip/php_test.php gives me"The requested URL /php_test.php was not found on this server."
I don't see an option to attach a file and hate to do this. httpd.conf is here: |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 06 Apr '12 8:03 Post subject: |
|
|
not supposed to anyway. I saw it .. I have a question tho.... what is in g:/wamp/alias ?
also, what do you get from http://localhost? |
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Fri 06 Apr '12 15:13 Post subject: |
|
|
Thanks guys for continuing to help.
Yesterdays error log shows:
Fri Apr 06 08:57:05 2012] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in G:\\Wamp\\www\\php_test.php on line 8
open http://skip in browser
Http://skip shows WAMP server configuration screen - Apache, MSQL and PHP ,also showing extensions loaded.
http://localhost also shows above.
http://localhost/php_test.php gives error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in G:\Wamp\www\php_test.php on line 8
Contents of php_test.php file:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<P> This is HTML</P>
<?php
Echo "Hello, World!" this is PHP from "wamp/www" site folder;
?>
</body>
</html>
The PHP test file in each vhosts dir indicates the residing vhosts folder. In bold type above.
Http://skip/php_test.php
error:
The requested URL /php_test.php was not found on this server. ( file is there)
Apache error log:
[Fri Apr 06 08:40:17 2012] [error] [client 127.0.0.1] script 'G:/Wamp/www/php_test.php' not found or unable to stat
Apache error log for above:
Fri Apr 06 08:57:05 2012] [error] [client 127.0.0.1] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in G:\\Wamp\\www\\php_test.php on line 8
contents
G:/wamp/alias
phpadmin.conf
sqlbuddy.conf
webgrond.conf
[/b] |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Fri 06 Apr '12 21:10 Post subject: |
|
|
That php code should be
Code: |
<?php
Echo '"Hello, World!" this is PHP from "wamp/www" site folder';
?>
|
or
Code: |
<?php
Echo "\"Hello, World!\" this is PHP from \"wamp/www\" site folder";
?>
|
|
|
Back to top |
|
rob62
Joined: 22 May 2007 Posts: 54 Location: mi
|
Posted: Fri 06 Apr '12 21:49 Post subject: |
|
|
Copied and past each of your code in php_test.php
http://skip/php_test.php gives error:
( ! ) Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in G:\Wamp\www\php_test.php on line 8 |
|
Back to top |
|
Triple_Nothing
Joined: 01 Apr 2012 Posts: 39 Location: WI, USA
|
Posted: Fri 06 Apr '12 23:38 Post subject: |
|
|
Odd. Both his items seem to look just fine. Can you post your updated php_test.php file? |
|
Back to top |
|