LinuxQuestions.org
Help answer threads with 0 replies.
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 06-08-2009, 04:05 PM   #1
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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
 
Old 06-08-2009, 04:50 PM   #2
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
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.

Here's the relevant code:
Code:
RewriteEngine on
        RewriteRule ^/$ /Nagios [R,NE]
 
Old 06-09-2009, 08:21 AM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831

Original Poster
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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?
 
Old 06-09-2009, 08:39 AM   #4
secesh
Senior Member
 
Registered: Sep 2004
Location: Savannah, GA
Distribution: Ubuntu, Gentoo, Mythbuntu, ClarkConnect
Posts: 1,154

Rep: Reputation: 47
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.
 
Old 06-09-2009, 10:28 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831

Original Poster
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Resolved

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.
 
  


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
I cant to see a web site have message from Apache 2 miguelangelmendoz@gm Linux - Newbie 1 09-01-2008 03:52 PM
Apache Virtual Name-Based Hosting and Default Site Poetics Linux - Server 4 03-31-2007 11:28 PM
apache web site pinguim66 Ubuntu 13 08-19-2006 11:40 PM
DISCUSSION: Using Windows Directories for Default Apache 2 Web Site RavenLX LinuxAnswers Discussion 0 02-09-2005 12:59 PM
How To: Use Windows Partition for Default Apache 2 Web Site RavenLX Linux - Networking 0 01-18-2005 01:41 PM

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

All times are GMT -5. The time now is 03:45 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