Linux - SoftwareThis 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.
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.
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?
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.
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.
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.
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?
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.