• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Apache Virtualhost problems

bluestrobe

Platinum Member
So I got my PHP problem nipped now I'm onto setting up virtual servers. I put in the following code as explained on the apache website into httpd.conf.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.websiteone.com
DocumentRoot /www/websiteone.com
</VirtualHost>

<VirtualHost *:80>
ServerName www.websitetwo.com
DocumentRoot /www/websitetwo.com
</VirtualHost>

I made "websiteone.com" and "websitetwo.com" folders in the "htdocs" folder. My current web content still sits in the "htdocs" folder and figured the directory "www" as the code states was another name for it. Now when I goto start my server up it says those two directories don't exist. I tried changing the location path to htdocs and the full folder path with no avail. What am I doing wrong here? Apache2.0.55 with PHP4 and Win2k Server.
 
It's a pretty good bet you don't have a /www/anything on your windows machine 😛

What other strings exactly have you tried? If you've got the folders inside htdocs (which is kinda odd) you'd want:

DocumentRoot c:\path\to\apache\htdocs\www.websitefoo.com\
 
doh. didn't think of the *nix stuff. I'll had the folder in the htdocs just to try it but I want to move them to another location.
 
So I put in the full file path in thread and restarted Apache. I got the following error. The part that the "minimize" is covering the httpd.conf file name. The two folders are in the "www" directory I made. The code below is what is in my experimental httpd.conf file at the moment.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.websiteone.com
ServerAlias websiteone.com
DocumentRoot C:\Program Files\Apache Group\Apache2\www\websiteone.com
</VirtualHost>

<VirtualHost *:80>
ServerName www.websitetwo.com
DocumentRoot C:\Program Files\Apache Group\Apache2\www\websitetwo.com
</VirtualHost>
 
Read the error message and understand...

It's saying that DocumentRoot takes a single argument. It says that because it thinks you're giving it two arguments, not one. Why would it think that? Because "Program Files" has a space in it.

I don't know how Windows Apache parses its files, but I'd guess that you'll want to either put a backslash before that space, or just double-quote the entire location.
 
Originally posted by: cleverhandle
Read the error message and understand...

It's saying that DocumentRoot takes a single argument. It says that because it thinks you're giving it two arguments, not one. Why would it think that? Because "Program Files" has a space in it.

I don't know how Windows Apache parses its files, but I'd guess that you'll want to either put a backslash before that space, or just double-quote the entire location.


Thats what I figured but at this point I assumed too much with the project and went to the pros here looking to see if they seen what I see.

edit: quotations worked
 
I got the website directing worked out and am now trying to route the logs to their respective folders. This is what I originally tried:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.websiteone.com
ServerAlias websiteone.com
DocumentRoot "C:\Program Files\Apache Group\Apache2\www\websiteone.com"
ErrorLog "C:\Program Files\Apache Group\Apache2\logs\websiteone-error.log"
CustomLog "C:\Program Files\Apache Group\Apache2\logs\websiteone-access.log"
</VirtualHost>


That didn't work so I tried this:

<VirtualHost *:80>
ServerName www.websiteone.com
ServerAlias websiteone.com
DocumentRoot "C:\Program Files\Apache Group\Apache2\www\websiteone.com"
ErrorLog "C:\Program Files\Apache Group\Apache2\logs\websiteone\error.log"
CustomLog "C:\Program Files\Apache Group\Apache2\logs\websiteone\access.log"
</VirtualHost>


I basicly want to have each website with their own set of logs. Anyone have any ideas?
 
I haven't worked much with Apache/w32, but that looks like it should work.
What error message are you getting?

Assuming now that you went ahead and created the log directories by the way, Apache won't do that for you, unless it does things very differently under Win32 🙂
 
the log directories are there and I manually created the log files too.

edit: it gives me the typical "Syntax error on line XXX of config file"
 
Ah, didn't notice it, but you're missing the log format argument for CustomLog
Just use "common" unless you wanna do anything fancy.

So:
CustomLog "C:\Program Files\Apache Group\Apache2\logs\websiteone\access.log" common
 
Originally posted by: bluestrobe
That worked. Thanks!

Also what does the "httpd.pid" do?

Well, if it's the same under Win32 as it is under *NIX, and I can't imagine it isn't, it's basically just a one line text file that contains the process ID number for the parent apache process.
So, if you wanted to make your own start/stop script for Apache, you could issue something like "kill `cat httpd.pid`" to kill the server.

Many apps of *NIX origin have those.
 
Back
Top