LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Very newbie Apache question (https://www.linuxquestions.org/questions/linux-newbie-8/very-newbie-apache-question-434105/)

Azhrarn 04-11-2006 10:57 AM

Very newbie Apache question
 
Heya!
I know its simple but I m stuck.
I m a bit confused about Locations, Virtual Servers and Directories in Apache 2.0

How do I make it so by opening
http://mycomputer/page/

on my computer
/usr/azhrarn/stuff/page.htm opens?

I have apache working, I just need the link
Also, page.htm cannot be moved.
Thanks a million!
Cheers
Azhrarn

vmlinuz.gz 04-11-2006 11:33 AM

To access /usr/azhrarn/stuff/page.htm, find your httpd.conf in /usr/local/apache2/conf/httpd.conf. Change your document root by editing the file.

First, you will want to change what says after "DocumentRoot." In my case, it's on line 104. It should be at least somewhere around there for yours. If not, try doing a pattern search. Anyway, substitute

Code:

DocumentRoot "<default_document_root>"
for

Code:

DocumentRoot "/usr/azhrarn/stuff"
You'll also have to change your <Directory>. Mine is on line 131. Change

Code:

<Directory "<default_document_root>">
to

Code:

<Directory "/usr/azhrarn/stuff">
If you want something other then index.html to be served by default (page.htm) in your case, find your DirectoryIndex. Mine is on line 166. Add a line that says

Code:

DirectoryIndex page.htm
if you wish.

Now, you should be ready. If you set you DirectoryIndex to page.htm, entering http://localhost/ in your browser should do the trick. If not, http://localhost/page.htm will do the same thing.

Also, make sure apache is running:

Code:

$ sudo apachectl start

Azhrarn 04-12-2006 02:44 AM

Thanks a mil, works like a dream.
Just one more question however, how would I come about configuring it if I wanted it to be accessed using

http://server/page/page.html (subdirectory)

rather than

http://server/page.html (default)

Thanks!!
Azh

twantrd 04-12-2006 01:24 PM

Make another directory called "page" under your DocumentRoot and change that path in httpd.conf as well. You also would need to add "page.html" in your directory index.

I would suggest reading up on apache and how it works on google. You will gain tons of valuable information on one of the best webservers out there.

-twantrd


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