logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: using a simple URL on a localhost
Author
jvezina



Joined: 13 Apr 2006
Posts: 3

PostPosted: Thu 13 Apr '06 19:44    Post subject: using a simple URL on a localhost Reply with quote

Hi,

I've got Apache 2.0.51 on XP (w/ PHP, mySql, etc). Basically it just runs on my machine for my own use before publishing things out to the public host on the internet.

To access my site, I can use: http://localhost:8080, and everything works fine (except for some new software I want to use - but that's a different issue).

What I want to be able to do, is use a URL like: http://www.mymachine.com instead of localhost:8080.

Oh, I get a dynamic IP from my ISP (figured you might want to know that).

I'm assuming setting up a virtual host is the way to go (please correct me if I'm wrong).

After going through this (& other forums) I tried out various things in my httpd.conf file. None work - I always get the "page cannot be displayed" problem.

Here's the relevant info out of httpd.conf:
Listen 8080
ServerName littleGuy.mymachine.com:8080
UseCanonical Off
DocumentRoot "C:/web/sandbox"
<Directory "C:/web/sandbox">
Options Index FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
HostnameLookups Off

NameVirtualHost *

<VirtualHost localhost>
ServerName www.mymachine.com
DocumentRoot "C:/web/sandbox"
ErrorLog logs/mymachine-error.log
CustomLog logs/mymachine-access.log combined
</VirtualHost>


Again, the idea is an easy way to use a regular style URL on my personal machine (just for me) rather than localhosts:8080.

Thanks in advance for you help,
jim
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Thu 13 Apr '06 21:24    Post subject: Reply with quote

First you have to change the listen and the name
Listen 80
and
ServerName littleGuy.mymachine.com:80

Secondly

<Directory "C:/web/sandbox">
.....

is also needed the Virtual host container.
NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.mymachine.com
DocumentRoot "C:/web/sandbox"

<Directory "C:/web/sandbox">
Options Index FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

ErrorLog logs/mymachine-error.log
CustomLog logs/mymachine-access.log combined
</VirtualHost>

If you want to acces your server by a name and not by your IP you have to a dynDNS name like yourhost.dyndsn.com
http://www.dyndns.com/
Back to top
jvezina



Joined: 13 Apr 2006
Posts: 3

PostPosted: Fri 14 Apr '06 18:56    Post subject: not quite there yet with the virtual host Reply with quote

Thanks James for the help. I did what you said, experimented a bit, walked away for awhile, experimented a bit more, but not quite there.

I changed the initial documentRoot to an invalid directory, and set the virtualHost documentRoot to the proper directory - just to be sure it's paying attention to the virtualHost configurations. The good news is it is when I use http://localhost:80.

It's still not recognizing http://www.mymachine.com though.

There are two things I didn't do though. The first is "Options Index FollowSymLinks". That gives me an error & apache won't start. I changed it to "Options FollowSymLinks" and apache starts & I can get to the site.

The second thing was using www.dyndns.com. I figured that'd be good if I wanted to access the site from the internet, but I only want to do it from my local machine.

Any ideas?

Thanks & great working sign.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7294
Location: Germany, Next to Hamburg

PostPosted: Fri 14 Apr '06 20:47    Post subject: Reply with quote

If you want to access your PC with www.mymachine.com you have to edit the hosts file in C:\WINDOWS\system32\drivers\etc If you want to get access in the intranet you have to edit the hosts file on every PC.
if you changed listen to 80 (for Port 80) you can access http://localhost/ you don't need :80 in the url, cause the Port 80 is the standart Port for http.
Back to top
jvezina



Joined: 13 Apr 2006
Posts: 3

PostPosted: Fri 14 Apr '06 20:53    Post subject: URL on local machine Reply with quote

Thanks! That did it!
Back to top


Reply to topic   Topic: using a simple URL on a localhost View previous topic :: View next topic
Post new topic   Forum Index -> Apache