Jump to content
The Uniform Server Community

Mapping folders to web server


Inspired
 Share

Recommended Posts

Hi Folks,

I am real pleased to have discovered Uniform Server.

When I use to develop ASP based sites I was able to set the Windows web server to map site directories from a location outside the www root.

 

In my case I had (and still have) all my development files in a folder called "Webroots" which is at D:\webroots\

 

My Documents maps to D:\ on my computer as I like to have all user files on one partition separate from the OS and Apps.

 

Anyway... on the windows server I somehow had it so that each site was pulled up from its folder under d:\webroots

 

The advantage of this is that I only needed to keep one copy on my local machine, rather than a development copy and a testing copy.

 

I'd like to know if there is any way to do something similar in Apache on US ?

 

I've got as far as setting up virtual host in US but that's not quite what I'm after.

I don't want to have two copies of each development site locally, nor do I want to move my developement sites into the /udrive/www/ folder because all my development apps are configured for these sites to be where they already are.

 

Is it possible to do what I want here or am I singing with the angels on this one?

 

I'd greatly appreciate some tips on how to solve this one.

 

With thanks, :rolleyes:

 

Jonathan

-------------------------------------

For IT Tips, Tricks, and Info...

http://www.e-volutiononline.com/blog

Link to comment
Share on other sites

Update.

 

I've figured out that I am able to put any directory location into the Vhost setup. Correct?

 

I've set up what I thought would work. But when I go to http://testsite/ all I see is the purple/blue Uniform Serve logo page.

 

So there must be something else I need to do.

 

Here is what got added to the httpd.conf file:

<VirtualHost *>

ServerName test1

DocumentRoot D:\\Website Root\\www.testsite_1

</VirtualHost>

 

I used the UniS admin Vhost setup panel to do this.

It has also put the appropriate entry into the windows hosts file.

 

Any ideas why this has not work?

Does the space in the folder name stuff things up?

 

To test if that was the case, I renamed the directory to d:\WebsiteRoot\test1

 

So my httpd.conf entry now looks like this:

<VirtualHost *>

ServerName test1

DocumentRoot D:\\WebsiteRoot\\test1

</VirtualHost>

 

Now when I try to go to http://test1/ I get a 403 Permission Error:

------------

Forbidden

You don't have permission to access / on this server.

------------

 

I think I'll wait for those with more experience to point me in the right direction.

 

Thanks,

 

Jonathan :rolleyes:

-------------------------------------

For IT Tips, Tricks, and Info...

http://www.e-volutiononline.com/blog

Link to comment
Share on other sites

Now i never really tried Virtual Host outsie the main /www/ folder, but i dont know. It just might work...

 

Try going to /userver/user/local/apache/conf/httpd.conf file.

 

Edit that file and scrool down and look for:

 

#NameVirtualHost *

 

Replace it with this... uncomment it basically:

 

NameVirtualHost *

 

Try that and let me know if it works.... This should be before any of your Virtual Host config though...

Link to comment
Share on other sites

DocumentRoot D:\\WebsiteRoot\\test1

 

 

All you need to do is remove the double back slashes

 

So it looks like this:

 

DocumentRoot D:\WebsiteRoot\test1

 

 

So long as your test1 folder contains an index page of some description it will work!

 

An alternative way to get the correct path is to right click on the index page of your site.

Select properties and just left mouse drag across location, once highlighted, right click and copy.

 

In vhost delete /www/ and paste your new path.

 

Whatever you typed into: Name: (ex. newhost.localhost)

 

for example: fred.com

 

 

After re-starting the servers type it into your browser: http://fred.com

 

Your original should look like this:

 

ServerName test1.com --- is correct must have a dot

DocumentRoot D:\Website_Root\test1 --- remove double slashes, remove any spaces in path names, test1 is your folder with an index page

 

type http://test1.com

 

All path names shall not contain spaces, Windows thinks that after a space it is a parameter.

(Well screws things up badly after that)

 

Make those mods and it will work!

All the best Ric

 

:rolleyes:

Link to comment
Share on other sites

All you need to do is remove the double back slashes

...

 

<VirtualHost *>

ServerName test1.com --- is correct must have a dot

DocumentRoot D:\Website_Root\test1 --- remove double slashes, remove any spaces in path names, test1 is your folder with an index page

</VirtualHost>

 

 

Make those mods and it will work!

All the best Ric

 

Thanks for the help. I greatly appreciate it.

olajideolaolorun -- Thanks. I did already have that uncommented.

 

Ric --

I've set it up as you described. Same result though.

In hosts file I have:

127.0.0.1 test.org

 

In conf file I have:

<VirtualHost *>

ServerName test.org

DocumentRoot D:\Website_Root\test

</VirtualHost>

 

When browsing to http://test.org

I get a 403 Forbidden error

"Forbidden

You don't have permission to access / on this server."

 

Just like before.

 

By the way, it as when I set up the Vhost using the US interface that the double \\ was put into the path. Why does it do that?

 

Is there some particular permissions in windows I must add to the folder in question?

 

Also, I have an index.html and index.php file in the root of test directory so at least one of those should be pulled up, right?

 

Thanks,

 

Jonathan

-------------------------------------

For IT Tips, Tricks, and Info...

http://www.e-volutiononline.com/blog

Link to comment
Share on other sites

Also, I just now tried to set the localhost documentroot to D:\Website_Root

That works fine. I can browse http://localhost with it set up that way.

But if I try to browse http://localhost/mkp I get the same 403 Forbidden error.

I have checked the windows permissions and as far as I can tell they are exactly the same (i.e. \mkp inherits its permissions from \Website_root\)

 

This is really odd. I'd love to get to the bottom of it.

 

Jonathan

 

YAHOO!!! Solved....

Okay... figured it out.

In my development files I had the .httaccess file from the live site.

This was causing the issue.

Renamed that file and voila, it works.

 

Whew.

 

Nice.

 

Ric and co... thanks for the help. Really nice of you.

 

Cheers,

 

Jonathan :-)

-------------------------------------

For IT Tips, Tricks, and Info...

http://www.e-volutiononline.com/blog

Link to comment
Share on other sites

By the way, it as when I set up the Vhost using the US interface that the double \\ was put into the path. Why does it do that?

 

Excellent glad you got it working. :unsure:

As for the double back slashes I only use single slashes hence it just looked wrong.

Indeed Vhost does pop an extra one in. This rang an alarm bell hence I have tested Apache with single and double backslashes.

It appears Apache will happily run with either, just goes to show you do learn something new every day. :rolleyes:

Reason for this post, just in case anyone reading this thread gets the wrong impression Vhost works fine and Apache is happy with single or double backslashes.

All the best

Ric :angry:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...