SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Virtual host questions
-
May 14, 2009, 08:35 #1
- Join Date
- Jan 2008
- Location
- N43° 44.4824', W079° 13.9408
- Posts
- 2,220
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Virtual host questions
When you are adding a line to the host file like this
127.0.0.1 localhost mywebsite
Have you set the include path in the php,ini to point to the right place(s)? The section in the php.ini will look like:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
include_path = ".;c:\php\includes;c:\php\example"
Add one for each web app, separating them with a ;
-
May 14, 2009, 08:42 #2
- Join Date
- Oct 2008
- Location
- London
- Posts
- 862
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adding a host to the hosts file tells your system what IP it should connect to when asked to connect to the hostname. In this case you are telling that for localhost and mywebsite the IP address is 127.0.0.1. This IP address is so called loopback mechanism, which means that any traffic sent to that IP is sent to the very same machine which sent it (your own machine).
Adding a hostname to Apache VirtualHost configuration tells Apache how a request for the hostname should be handled. For instance you can specify which directory should be the document root for the requests (from which directory it should serve files).
include_path directive is PHP-specific and has nothing to do with client requests.Pawel Decowski (you should follow me on Twitter)
-
May 14, 2009, 08:58 #3
- Join Date
- Jan 2008
- Location
- N43° 44.4824', W079° 13.9408
- Posts
- 2,220
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adding a host to the hosts file tells your system what IP it should connect to when asked to connect to the hostname. In this case you are telling that for localhost and mywebsite the IP address is 127.0.0.1. This IP address is so called loopback mechanism, which means that any traffic sent to that IP is sent to the very same machine which sent it (your own machine).
How come if your using a virtual server like XAMPP the path name is not http://localhost/XAMPP/<whateverdirectory> in my case it's http://localhost/<whateverdirectory>
Adding a hostname to Apache VirtualHost configuration tells Apache how a request for the hostname should be handled. For instance you can specify which directory should be the document root for the requests (from which directory it should serve files).
include_path directive is PHP-specific and has nothing to do with client requests.
-
May 14, 2009, 12:08 #4
- Join Date
- Aug 2006
- Location
- earth
- Posts
- 923
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Look for something similar to this in your vhosts config file
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:\path\to\www"
</VirtualHost>
Since you added "mywebsite" to your host file you need to give it a directory as well. Just add this to the end of your vhosts config file.
<VirtualHost 127.0.0.1>
ServerName mywebsite
DocumentRoot "C:\path\to\www\mywebsite"
</VirtualHost>No, I REALLY dislike having to use Joomla.
-
May 14, 2009, 18:38 #5
- Join Date
- Jan 2008
- Location
- N43° 44.4824', W079° 13.9408
- Posts
- 2,220
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Where do I find my vhosts config file ? Are you saying that I can change
where currently have to go to http://localhost/test I can change that in the vhost config file ? And if so I'm a bit lost where the host file comes into all this?
-
May 14, 2009, 19:43 #6
- Join Date
- Aug 2006
- Location
- earth
- Posts
- 923
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It's the httpd-vhosts.conf file you mentioned in your first post. You can use your computer's search program to find the file.
If you're using XAMPP, Google "virtual hosts xampp"...there are plenty of walkthroughs out there.No, I REALLY dislike having to use Joomla.
-
May 14, 2009, 21:22 #7
- Join Date
- Jan 2008
- Location
- N43° 44.4824', W079° 13.9408
- Posts
- 2,220
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Alright I'll do a little google reading
And I found the file so thank you.
Bookmarks