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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
01-08-2005, 02:03 PM
|
#1
|
Member
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413
Rep:
|
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?
|
|
|
01-08-2005, 03:17 PM
|
#2
|
Member
Registered: Apr 2003
Location: belgium
Distribution: debian
Posts: 72
Rep:
|
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.
|
|
|
01-08-2005, 03:45 PM
|
#3
|
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:
|
but what if i want to have my site at /home/mysite
then what should i have to do?
|
|
|
01-08-2005, 04:08 PM
|
#4
|
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
|
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.
|
|
|
01-09-2005, 01:16 AM
|
#5
|
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:
|
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?
|
|
|
01-09-2005, 04:21 AM
|
#6
|
Member
Registered: Sep 2004
Location: St Andrews, United Kingdom
Distribution: Ubuntu Breezy 5.10
Posts: 31
Rep:
|
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
|
|
|
01-09-2005, 10:53 AM
|
#7
|
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:
|
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?
|
|
|
01-09-2005, 03:52 PM
|
#8
|
Member
Registered: Apr 2003
Location: belgium
Distribution: debian
Posts: 72
Rep:
|
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
|
|
|
01-11-2005, 05:53 AM
|
#9
|
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:
|
ok i got it thanx for your time all of you
|
|
|
01-11-2005, 06:58 AM
|
#10
|
LQ Guru
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 08:28 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|