LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache 2.2.3 issue. (https://www.linuxquestions.org/questions/linux-server-73/apache-2-2-3-issue-482349/)

Galaxy_Stranger 09-11-2006 04:05 AM

Apache 2.2.3 issue.
 
(Technically, this question is about the WINDOWS version of Apache, but I'll bet i'm going to run into the same thing when I implement on my Core5 machine.)

I recently got Apache 2.2.3 when I reformatted. I installed it and got it running real quick. Then, I got the bright idea to host another site on the server. I decided to use Name Virtal Hosts. I'm not getting the effects that I want.

As I understand it, you're supposed to configure your default server as normal. Then, you add the first virtual host which is identical to the default server settings. THEN you can add all the other virtual hosts you need. I restart the server and hit the site. The main site opens just fine. The second virtual host seems to hit, but gives me - "Error 403"..."You are not authorized to view this page".

At this point, I thought it would be some sort of permissions issue, which I've played with, but can't seem to improve any - I still get the same response. I've been to the Apache site and I've perused through this forum for a while and didn't find anything that helped.

Can anyone give me a checklist to go through of things that need to be done to setup virtual hosts? Here's a copy of the host I can't get access to:

Code:


<VirtualHost *:3000>
    ServerAdmin galaxy_stranger@hotmail.com
    DocumentRoot "d:\internet"
    ServerName planetrobotech.no-ip.com
<Directory d:\internet>
order allow,deny
  #Options All FollowSymLinks Indexes
</Directory>


Wim Sturkenboom 09-11-2006 05:53 AM

You try to access it on port 3000?

Galaxy_Stranger 09-11-2006 12:01 PM

Yes, indeedy.

Wim Sturkenboom 09-11-2006 10:23 PM

And you pass the port in the URL I suppose. So unfortunately I don't know.
Did you enable name based virtual hosting (on my machine it's disabled as I use SSL (and that only works with IP-based virtual hosting).
Code:

#NameVirtualHost *:80
Enable it by removing the '#'

Galaxy_Stranger 09-12-2006 03:57 AM

Yeah - tried every way of passing the IP and the port with and without the URL.
Anyway - I found out what the problem was. - I hadn't included the ALLOW directive in the virtual host settings: http://httpd.apache.org/docs/2.2/mod...uthz_host.html Turns out I had it right - just didn't allow myself access to the freaking host. Just in case anyone is interested, I'll briefly go over how I set it up.

First of all, go through the httpd.conf and configure everything you like for the main web page you're hosting. Just act like that's all you're going to host. Save the config file and make sure the server works and you have outside access to it - now you know it at least works.

Second, you need to add a second LISTEN line, specifying whatever other port you want to use. In my case, I have 80 and 8080.

Third, Scroll down to the "virtual hosts" section. You'll need to add lines that look like this:
Code:


NameVirtualHost *:80
NameVirtualHost *:8080
 
<VirtualHost *:80>
  DocumentRoot d:\my_main_web_page
#  The directory path above must be in quotes if you use spaces instead of underscores.
  ServerName myfirsturl.com
</VirtualHost>
 
<VirtualHost *:8080>
  DocumentRoot d:\internet
  ServerName mysecondurl.com
      <Directory d:\internet>
      Allow from all
      </Directory>
</VirtualHost>

As you can see, you need a "NameVirtualHost" line for each virtual host. The first host must reflect the main httpd.conf settings and inherits from that. The second host can be configured independently. As far as I can tell, there is no limit to the number of virtual hosts you can create.


All times are GMT -5. The time now is 11:44 AM.