Nagios webinterface error..You don't have permission to access /nagios/ on this server - nagios

I am getting the below error when I am accessing the web interface of nagios.
Forbidden
You don't have permission to access /nagios/ on this server.
Apache/2.2.15 (Red Hat) Server at localhost Port 80
Please help me .. I am working from one week still not resolved.

Couple of places to visit in the configuration files.
check your /etc/httpd/conf.d/nagios.conf file , if the option for SSL is turned on ,try disabling it
then
restart httpd service.
below is the sample entry from the file /etc/httpd/conf.d/nagios.conf
ScriptAlias /nagios/cgi-bin "/usr/lib64/nagios/cgi"
<Directory "/usr/lib64/nagios/cgi">
#SSLRequireSSL
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>
Alias /nagios "/usr/share/nagios"
<Directory "/usr/share/nagios">
#SSLRequireSSL
Options None
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/htpasswd.users
Require valid-user
</Directory>

Related

apache with different authentication domains for a location and a sub-location

I want to configure apache2 two different locations with authentication domain, but one location is a base path of the other.
So unfortunately only the base location configuration is used.
<Location "/xwiki/">
Options FollowSymLinks
AllowOverride None
AuthType Digest
AuthName "XWikiDomain"
AuthDigestDomain "/xwiki/"
AuthDigestProvider file
AuthUserFile /etc/apache2/passwd/passwd_digest_auth
Require user user1
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
<LimitExcept OPTIONS>
Require valid-user
</LimitExcept>
</Location>
<Location "/xwiki/wiki/subwiki/">
Options FollowSymLinks
AllowOverride None
AuthType Digest
AuthName "KWFDomain"
AuthDigestDomain "/xwiki/wiki/subwiki"
AuthDigestProvider file
AuthUserFile /etc/apache2/passwd/passwd_digest_auth
Require user user2
BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On
<LimitExcept OPTIONS>
Require valid-user
</LimitExcept>
</Location>
How can the configuration be done to get it working?
Regards Rainer

http-auth does not apply username/password to route53 address

I have set up http-auth for an ubuntu webserver running apache2. I have done this with the following steps (note that the instance already had apache2 running and an A record for the route53 dns address):
mkdir -p /etc/httpd/conf.d
apt-get install -y apache2-utils
htpasswd -b -c /etc/apache2/.htpasswd demo $PASSWORD
Then I created the file /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
DocumentRoot /var/www/blah/
ServerName some-test.blah.info
ServerAdmin some-random-admin
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/blah/">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
</VirtualHost>
Last I applied this change by restarting apache.
After this there is a credentials prompt (for the username and password) through the IP address but not the dns address set through route53.
I believe the issue is a route53 problem as it is working correctly when you go directly do the IP address.
The solution is to edit the /etc/apache2/apache2.conf and find the directories section (it should be lines 153 to 174) and add in the auth requirements. So basically find all the directories and add these four lines inside of each one:
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
For example this is what it originally looks like:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
And this is what it needs to be changed to:
<Directory />
Options FollowSymLinks
AllowOverride None
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
<Directory /usr/share>
AllowOverride None
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
<Directory "/var/www/blah/">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>

Why Apache started directing to different document root after commenting the HTTPS/ SSL?

I commented out HTTP to HTTPS URL Rewrite in my available site config cloud.conf and to my site it is not pointing to /var/www/html/ when earlier it was pointing to /var/www/php/! The only thing present in configuration is below.
cloud.conf
<VirtualHost *:80>
ServerName 192.168.1.3
DocumentRoot /var/www/php/
<Directory /var/www/php/>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
order allow,deny
allow from all
</Directory>
</VirtualHost>
If I try enabling site:
$ sudo a2ensite cloud
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Site cloud already enabled
It says it's already enabled.
in the default apache2.conf I have
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/php/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Even after sudo systemctl restart apache2 or sudo systemctl reload apache2! I have noticed that redirection of HTTP to HTTPS is still occurring and don't know what is driving that do I have to disable any module?

Resolve Error default site does not exist after update to Ubuntu 13.10 and apache 2.4

I updated my ubuntu lately, I wanted to program in my Ubuntu 13.10, and was setting up apache2, and every time I run the command:
sudo a2ensite default
I get the following error:
Error default site does not exist
how can I fix this issue?
To fix this and any other virtual host running on apache 2.4 I needed to set the
default (and any other virtual host you have)
as
default.conf (add .conf any virtual host you have already set)
Enter the console (terminal) and type the following commands:
sudo mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.conf
sudo a2ensite default
And we will get the following:
Enabling site default. To activate the new configuration, I needed to run: service apache2 reload
now run:
service apache2 reload
and done.
or create the default.conf file if you don't have it and this is what it should contain by default:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
The simple way of doing it is adding your .conf file or your virtual host configurations to the site-available folder and then when in the folder and then try again. Worked for me.
I had the same problem, so I tried changing my virtual host configuration file name from default to default.conf, as mentioned here, and it was still not working.
At last i got it. It is necessary also to change the code:
Order allow,deny
Allow from all
to
Require all granted
http://httpd.apache.org/docs/2.4/upgrading.html
After that, I've restarted apache and it worked again

Accessing website files and phpmyadmin in wamp from another computer on lan

I have my files hosted on one computer acting as the server , but I want to access the root (www) directory files and the phpmyadmin from another computer on the lan.By access I mean to edit them and open them to see and make changes to the database and code.How is it possible?
By default WAMPServer is configured to be a standalone development system for running on your workstation.
If you want to run Wamp on one PC and access it from another you have to change the Apache security configuration.
You dont mention anything useful like the version of WampServer you are running so I guess I will have to document both options
Edit httpd.conf ( using the wampmanager menus )
If Apache 2.2.x
Locate this section, I have remove all the comments for the sake of brevity.
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
Change to :
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1 localhost
## Add an ip range that matches your routers first 3 quartiles
## So if your router subnet is 192.168.0 ( use ipconfig to find out what your router is set to )
## This will allow any PC on your internal network to access the www folder and subfolders
Allow from 192.168.0
## Or you can specify a specific ip or set of ip's like this
## Allow from 192.168.0.10 192.168.0.11 192.168.0.12 ....
</Directory>
If Apache 2.4.x
Find this section
<Directory "c:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - do not remove
Require local
</Directory>
Change to :
<Directory "c:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride all
#
# Controls who can get stuff from this server.
#
# onlineoffline tag - do not remove
Require local
Require ip 192.168.0
## Apply the same logic as above for specific ip's or a set of ip's
## i.e. Require ip 192.168.0.10 192.168.0.11 .....
</Directory>
Now to gain access to phpMyAdmin you have to edit this config file
Edit C:\wamp\alias\phpmyadmin.conf
You need to make the same sort of chnage in here as you did above
Apache 2.2.x
Change this
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1
</Directory>
To
<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 ::1
Allow from 192.168.0
</Directory>
Apache 2.4.x
Change this
<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
</Directory>
To
<Directory "c:/wamp/apps/phpmyadmin4.0.4/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require local
Require ip 192.168.0
</Directory>
If you can follow all that you should be able to access your site and phpmyadmin from your internal lan.
As to editing the source of your site, you will have to share the c:\wamp\www folder on your server and then map that share on the PC you are working on.

Resources