[SOLVED] Apache 2 on RHEL5 - Default to one web site but allow others
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.
Apache 2 on RHEL5 - Default to one web site but allow others
What I'm trying to do is use the standard RHEL5 Apache2 setup as delivered. It allows me to access things such as <servername>/manual or <servername>/nagios by use of /etc/httpd/conf/httpd.conf (global) and /etc/httpd/conf.d/ files (modules) for different purposes. The nagios.conf in that directory was created by following the instructions for Nagios install on Fedora (this being the closest analog of RHEL5).
What I need to do is have a default name open Nagios instead of requiring me to go to <servername>/Nagios. However I'd also like to still be able to access such things as <servername>/manual.
Above is the gist of my question which is how to do this?
You can read the below to see what I've tried but if you do keep in mind my intent is the above so if what follows is on the wrong track ignore it and please assist with the above instead.
My first thought was to modify:
Alias /nagios "/usr/local/nagios/share"
To:
Alias / "/usr/local/nagios/share"
But when I tried to do that by modifying /etc/httpd/conf.d/nagios.conf and restarted httpd it complained about having multiple "/" aliases noting that some would likely be ignored.
On further reading I decided to investigate use of Apache virtual host (by name) and created a virtual host definition using the contents of nagios as the basis for my virtual host definition in httpd.conf. Again I set the Alias as shown above but this time in the virtual host instead of the nagios.conf.
It actually defaulted to Nagios and prompted me for password as expected but then I see:
Quote:
Forbidden
You don't have permission to access / on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.3 (Red Hat) Server at ema2.water.com Port 80
I was tempted to just post 'mod_rewrite' and walk away because I'm by no means an expert here, but given your a SR member from GA, I thought you deserved better so I took the time to do a little testing.
Yep - Senior on the list - Maybe Senior doing UNIX/Linux but newbie on setting up web stuff - most of the web servers I support have dedicated web administrators so I typically haven't had to do more than dabble here and there in Apache.
Thanks for the post. I'm assuming this goes in the Virtual Host?
yes. I tested by adding these lines first under my vHost declaration. I didn't remove latter declarations for <Directory />, which you'll still need to get at things that are under /, like /manual. And you need to ensure mod_rewrite has been loaded to apache.
^ means start of line.
$ means end of line.
the difference is that in your first post, you're pushing / to /nagios/share, and we wouldn't find /manual under /nagios/share. By rewriting only requests for /, everything else stays in place. ...I'm having a hard time explaining the concept.
Thanks again. Putting it in the Virtual Host didn't work but getting rid of the virtual host and just putting it at the end of the httpd.conf did. Now when I type the host name or the alias name I'd put in DNS both default to the /nagios page. (Note I had to set it to "nagios" rather than "Nagios" due to case sensitivity.)
Now if I just go to the host it goes to Nagios. If I specify host/manual it pulls up the manual page for Apache which is what I was trying to accomplish.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.