httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Smith" <g...@primeexalia.com>
Subject RE: [users@httpd] Can you straighten me out? (
Date Thu, 06 May 2004 23:56:12 GMT
In your configuration you can add an entry for Alias for each subfolder that can do this for
you.
 
Alias /geoworld/images /images
Alias /gepbop/images /images
...
 
(or something like this.  I don't have the Apache doc's at my disposable right now).  
 
HTH, 
 
Gary
 

________________________________

From: David Blomstrom [mailto:david_blomstrom@yahoo.com]
Sent: Thu 5/6/2004 4:00 PM
To: users@httpd.apache.org
Cc: david_blomstrom@yahoo.com
Subject: [users@httpd] Can you straighten me out? (



I installed Apache, PHP and MySQL on my computer a few
months ago, using a preconfigured package from "Apache
Friends."

I learned just enough about Apache to get everything
up and running and have just been focusing on PHP
since then. However, I just discovered that I may need
to change my configuration; or maybe it wasn't really
right to begin with.

For whatever it's worth, I'm using Dreamweaver and
have all my sites in a folder named sites. Thus, the
path to my site named Geobop is C:/sites/geobop, and
the path to GeoWorld is C:/sites/geoworld

When I preview a page from one of my sites, it looks
something like this:

http://localhost/geoworld/index.php

I thought that was the "standard" and most highly
recommended configuration. But I've been trying to
figure out a better linking system, asking questions
on Dreamweaver and PHP forums, and a couple people
told me I should change my configuration, especially
if I want to work with site-root relative links.

Basically, I want to be able to insert a link that
looks something like this:

/geoworld/images/bird.gif

and it will work both on my local sites and online. If
I understand them correctly, my local URL should look
like http://geoworld/index.php, rather than
http://localhost/geoworld/index.php

I was also advised to make a LOCAL subdomain for my
images.

I appended some instructions I was given for making
the necessary changes, with links to some Apache
tutorials.

But before I take the plunge, I just wanted to solicit
some advice from this list. Does it sound like I'm
doing the right thing? Do most of the pros preview
their sites as http://localhost/geoworld or
http://geoworld ?

I'd especially like to know if messing with Apache
might somehow mess up MySQL or PHP. They should be
unaffected, right?

I'll start reading up on this stuff now. I was just
hoping to get some feedback from people who might
catch me before I do something stupid.

Thanks!

* * * * * * * * * *

>>How do you create a sudbomain locally,

Depends on the server.
I assume you run an Apache (if not, then you have to
look at the manual
or some HowTos in the web), so you can do it with the
VirtualHost option
in the httpd.conf file. Two things are necessary,
first:

  NameVirtualHost 127.0.0.1

http://httpd.apache.org/docs/mod/core.html#namevirtualhost

This enables name-based virtual hosts for the given IP
(could also be a
* to match all IPs). The second are the settings for
the virtual host
itself (there are some more for configuring logfiles
etc.):

  <VirtualHost 127.0.0.1>
    DocumentRoot /path/to/your/website/folder
    ServerName geoworld.localhost
  </VirtualHost>

http://httpd.apache.org/docs/mod/core.html#virtualhost

This enables Apache to redirect all requests for
geoworld.localhost to
the given DocumentRoot (the directory that contains
the pages, images,
etc.). After restarting Apache it should be listening
for requests for
that new virtual server (actually it doesn't have to
be a subdomain to
localhost, you can choose whatever name you like).

Now only one thing is missing - the OS knows nothing
about the "new"
server, you have to edit the hosts-file, on W2k it's
located in
\WINNT\system32\drivers\etc. This file contains
nothing but the line

127.0.0.1     localhost

by default. Simply add another line with the IP and
name of your new
virtual server:

127.0.0.1     geoworld.localhost

Now when you enter http://geoworld.localhost in your
browser, Windows looks up the IP-address and sends the
request to the server, Apache recognizes the name
geoworld.localhost and redirects to the configured
virtual host directory.

Sounds more complicated than it actually is. Now you
have two ways for accessing your local website:

http://localhost/geoworld/
http://geoworld.localhost/

The difference is small, but important: The first is
only a directory below the domain root, while the
latter is a "real" domain, allowing site-root links.

>>So if I create a LOCAL subdomain, then publish it
online, I'll get the
>>proper URL instead of http://geoworldNA.localhost?

Yes, links like "/images/foo.gif" will work locally
and online.



       
               
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs 
http://hotjobs.sweepstakes.yahoo.com/careermakeover

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message