LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-08-2005, 02:03 PM   #1
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Rep: Reputation: 32
apache httpd.conf


hi
I am new to apache.
what I want is that I have to run mrtg on my computer and other websites that I have to test locally.
I want that when I type
http://localhost/mrtg
in my browser then it should goes to /var/www/html/mrtg directory and show the default index.html file
similarly when I type
http://localhost/web1
then it should go to the /var/www/html/web1 directory and show me the default index.php or index.html file

but I don't know that what and where to make the changes in httpd.conf file.
So please tell me what should i do?
 
Old 01-08-2005, 03:17 PM   #2
stoffell
Member
 
Registered: Apr 2003
Location: belgium
Distribution: debian
Posts: 72

Rep: Reputation: 15
Well, in my opinion, if you /var/www/ is your standard webroot, just create the subdirectories (make them +rx for the apache user or world) and type the url to open the index.php or .html. (you can change the default index pages in you apache.conf also)

If you need any more info, please try it and let us know.
 
Old 01-08-2005, 03:45 PM   #3
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
but what if i want to have my site at /home/mysite
then what should i have to do?
 
Old 01-08-2005, 04:08 PM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
You want to investigate name-based virtual hosting. If you use that, you could have mrtg.mysite.com point to one directory and web1.mysite.com point to another directory. You can specify the exact directory in each virual host declaration in httpd.conf. Those directories dont have to be in the Apache default, but they do have to be readable by the Apache user.
 
Old 01-09-2005, 01:16 AM   #5
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
but i don't have bought a domain name I want to run it locally (localhost) and test my sites
can anyone tell me the exact syntax?
 
Old 01-09-2005, 04:21 AM   #6
yussef
Member
 
Registered: Sep 2004
Location: St Andrews, United Kingdom
Distribution: Ubuntu Breezy 5.10
Posts: 31

Rep: Reputation: 15
hey there,

For apache, there is a configuration file called httpd.conf which is located at /etc/apache (in Debian).

In that file there is a parameter called DocumentRoot. On Apache 1.3 it looks like this:

Code:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot /var/www
and you can change your document root's location.
For example I see you want to have /var/www/html/web1 to be accessible by http://localhost/web1 , then you just make /var/www/html your document root.

Hope you understand

PS: here is a site thath might help you http://www.idevelopment.info/data/Pr...e_1_3_27.shtml
 
Old 01-09-2005, 10:53 AM   #7
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
but if i do
http://localhost/mrtg
then doing this does not automatically loads index.html file
i want that when i open http://localhost/mrtg it should automatically load the default file.
how can I do that?
 
Old 01-09-2005, 03:52 PM   #8
stoffell
Member
 
Registered: Apr 2003
Location: belgium
Distribution: debian
Posts: 72

Rep: Reputation: 15
what error does it give you?

you should place a trailing / in the end. ( http://localhost/mrtg/ )

Or set this parameter in httpd.conf:
UseCanonicalName on
 
Old 01-11-2005, 05:53 AM   #9
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
ok i got it thanx for your time all of you
 
Old 01-11-2005, 06:58 AM   #10
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
It's best to allow users to use one of their subdirectories in /home as their www directory without interefering with the main /var/www directory. To do this, do you need to look for something like the lines below in your httpd.conf file.

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
#
# The path to the end user account 'public_html' directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a "403 Forbidden" message.
#
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden
#
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
UserDir public_html

#
# To enable requests to /~user/ to serve the user's public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
#UserDir public_html

When you find it just follow the instructions from the top of the section. All you will need to do is create a public_html subdirectory in /home. chmod it to 755 and put your pages in there. To access them you would do something like http://localhost/~userid and if you create subdirectories in there, you can access them by doing http://localhost/~userid/subdirectoryname. Hope this helps

Last edited by reddazz; 01-11-2005 at 07:00 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache httpd.conf file?? matux Mandriva 2 01-28-2005 09:20 AM
Apache httpd.conf help BoardinBum Linux - Software 4 12-29-2004 12:59 PM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM
apache httpd.conf https Hube Linux - Software 7 04-07-2003 08:52 PM
apache httpd.conf plisken Linux - Software 1 02-01-2003 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration