I installed Nagios on my system (Fedora 21) but when I start it from the browser it throws the error:
Unable to get process status error.
I have added the following lines in my httpd.conf file
ScriptAlias /nagios/cgi-bin/ "/usr/local/nagios/sbin/"
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all
Alias /nagios/ "/usr/local/nagios/share/"
<Directory "/usr/local/nagios/share/">
Options None
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
nagios.log entries:
[1423829856] Warning: Return code of 127 for check of service 'Total Processes' on host 'localhost' was out of bounds. Make sure the plugin you're trying to run actually exists.
In my case the resolution was sinply to start the Nagios service as
sudo systemctl start nagios.service
after which the error that you were seeing as
Unable to get process status error.
should now look something like
Daemon running with PID 9027
I think there is an issues with the nagios-plugins, You will have to reinstall it. Please try with the following command.
yum reinstall nagios-plugins
I was facing the same issue while upgrading to the newer version of Nagios Core.
After adding the following two lines into nagios.conf:
state_retention_file=/usr/local/nagios/var/retention.dat
status_file=/usr/local/nagios/var/status.dat
the problem doesn't persist anymore!
Thanks to Pety's answer above, I found that my issue was that the ownership of the directory where the "status_file" and "state_retention_file" did not allow nagios account to read/write files. Correcting ownership seemed to fix my issue.
Related
I am trying to set up Apache2 on my Ubuntu system. It's has been installed and working. The problem is that I'm working on an AngularJS project and I need a server for my html pages. Right now the directory is set to:
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
When ever I try to change it to a specific path I always get the 403 Forbidden error. The path I want it changed to is:
/home/michael/dev/JavaScript/AngularJS/Quiz App
When the system is set to the default path and I reload my html page using Sublime Text and I get a 404 error. The html page is:
http://localhost/01_01/index.html
I've been up all night trying to fiqure this out and did the best I could to resolve it. I'm open to any possible solutions you guys may have.
It is because Apache2 does not have permission to access path within your home directory. One thing you can do is to create a symbolic link in /var/www/html and pointing it to your code directory.
ln -s "/home/michael/dev/JavaScript/AngularJS/Quiz App" /var/www/html/quizApp
No open the browser and type localhost/quizApp and you should be able to open your app in the browser
I have what is almost certainly a newbie question. I expected to find the issue while writing this question, but I am still stuck.
I want to change the DocumentRoot for apache, but I keep getting the error message "DocumentRoot must be a directory".
Situation:
The code is running in a virtual VMWare machine 4.0.4 build-744019
The version of linux is Scientific Linux release 6.4 (Carbon)
The version of apache is Apache/2.2.15 (Unix) (this is a yum install with nothing
special)
In the httpd.conf
DocumentRoot "/home/stave/www"
When I restart, I get the message
Starting httpd: Syntax error on line 292 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
Steps taken so far:
I ensured that the directory exists:
ls -asl /home/stave
4 drwxrwxrwx. 2 stave stave 4096 Feb 9 09:08 www
It even has a file in it "index.html", so I am very sure that the directory exists
I considered that it might be a priviledges issue so (this is a virtual development machine isolated from the internet, and I am troubleshooting so I am not too worried about security) as you can see I set the priviledges to 777.
I even changed the user that apache is running as (and confirmed that the change worked with ps) to stave to ensure that priviledges just shouldn't be an issue.
Stackoverflow
There are a few stack overflow answers, but most of them say "read the error message. It is saying that the directory doesn't actually exist". Others implied that there might a trailing slash at the end which would be bad.
Other websites
The most useful I found was this that advised
You probably got "DocumentRoot must be a directory" error even it is really a directory because of SELinux extensions. Run system-config-securitylevel (or redhat-config-securitylevel) to disable SELinux for httpd or give SELinux permissions to that
directory:
chcon -R -h -t httpd_sys_content_t /path/to/directory*
My version of linux isn't Security Enhanced Linux, so without understanding I tried it anyway: no effect.
Current situation
I have run out of ideas to try, so any diagnostic questions or advice would be greatly appreciated
The link you posted under "Other websites" highlights the root cause of your problem, which is Selinux.
Unless the server is part of a super secure environment, I would simply disable Selinux.
On RedHat / CentOS / Scientific Linux this can easily be done by editing /etc/sysconfig/selinux - find the parameter "selinux" and change the option "enforcing" to "disabled" as per the extract below:
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
It is probably wise to reboot the server after making this change.
You shouldn't just disable SELinux.
You need to set httpd_enable_homedirs to on.
yum -y install policycoreutils-python
setsebool -P httpd_enable_homedirs on
I ran into this problem today as well and it was because I moved my DocumentRoot from /var/www/html to /srv/www/html. As part of our security policies, we do not have the option to just Disable SELinux.
SO my fix, as I discovered was to change the SELinux file context for /srv to match /var. A compromise yes, but still better than disabling it altogether. Other than that... I made sure /srv/www and all subfolders had the httpd_sys_content_t to match the folders under /var/www and all is well now.
This is basically the same answer as David's, but just a little clearer, http serving directory has wrong SELinux security context set.
The full explanation to fix this is here, http://mybroadband.co.za/vb/showthread.php/588183-Fix-403-Forbidden-on-newly-configured-CentOS-6-5-httpd-server-(or-13-10-Ubuntu-LAMP)
My issue was that I was housing my websites inside a different directory than the documentroot path of /var/www/, so I had to follow the 3rd option in the link above to correct. I set the same file context of my /websites/ directory to match that of the /var/www/. What was odd is earlier versions of CentOS 5.5 must not have had the SELinux installed/enabled, because my other servers had no issue with this and when running the ls -Z at the command prompt displayed those folders as 'unlabeled'.
I'm running CentOS 6.5 on AWS from the official marketplace minimal install. So when I ran the ls -Z command on my folders I saw exactly what the link above shows as a possible issue.
Running the chcon command fixed my issue!
Just replace html/ with the directory you want to use!
chcon -Rv --type=httpd_sys_content_t html/
chcon -Rv --user=system_u html/
On a side note I also had to disable iptables to get the routing working, the defaults were serving up blank pages.
service iptables stop
Hope that helps anyone with the same issue.
Envirnoment:
Linux - root file system on a SSD
DocumentRoot on a HDD and mounted via fstab
Restarting apache2 after boot - no problem
Seems to be a timing problem that apache is started before the fstab mounts are completed.
Workaround:
Define the DocumentRoot directory on the root file system with the correct owner, group and permissions. The directory may be empty.
Firstly, there is no reason at all to turn off selinux to fix this issue, just change the selinux file context.
Secondly, when changing selinux file context, you should to set up a permanent rule for that path, such that when new files are copied in and/or replace existing files, restorecon actually fixes the problem, instead of breaking it, as is the case when you only use chcon.
Thus, for a symlink'ed DocumentRoot (let's give the actual full path to the directory as '/media/myDoc' for this example), run these two commands:
semanage fcontext -a -t httpd_sys_content_t "/media/myDoc(/.*)?"
restorecon -R /media/myDoc
Note, the full path is required when using semanage this way. You will not only fix the problem, but it won't break again when you run restorecon (or auto-relabel) in the future.
I am trying to get my OSX MacPorts install of Apache to NOT show directory listings. I have tried various configurations of the "options" directive in the httpd.conf file with no luck. When I go to the site, it still lists the root directory (there is no index file at the moment.)
Apache has been restarted after each change.
There is no .htaccess file in the / directory, so there shouldn't be anything overriding.
This is driving me crazy!
So basically something is overriding your config. From the documentation of apache we can read that Options is can be placed in various context: server config, virtual host, directory, .htaccess.
httpd.conf is read first, so if You provided the configuration properly there, it means that it is overridden somewhere else
How did You do enter the options in the config ? In the most basic variant it should be.
<Directory /path>
Options -Indexes
</Directory>
Here what you should do:
check module configurations in modules for Options Indexes
check the main virtualhost definition, probably called default or 000-default
If it still does not help, add Options -Indexes to your virtualhost directly (provided you have not done it already). Or add it to the .htaccess file in your directory (allowing Options in .htaccess needs to be switched on)[as suggested in comments]
I am trying to install typo3 as per the instructions but I have a bit of a puzzle to solve.
It seems apache denies access to any files I try to access via any symbolic link in the site root directory. I have changed permissions from SymLinksIfOwnerMatch to FollowSymLinks and no joy.
I'm working on mac OSX (SL) and installing in my user's "Sites" directory. I can access any files in this CMS directory via the web browser just not anything through symbolic links.
I hope konsolenfreddy's comment was helpful already. I am trying to round things up here:
First check if the symlinks work from terminal and/or the filesystem in general.
Also, if you use absolute paths, the whole path from root to the file in question must be readable by the Apache user. *
If yes, check if the AllowOverride option is set for your webserver (or if applyable for the virtual host) For debugging you can set AllowOverride All in either apache2.conf, httpd.conf or in sites-available/default
If yes, check if FollowSymlinks is aktivated in any of the files responsible for your webroot, starting with apache2 working yourself down to the .htaccess files.
Try changing file permissions on the symlink file and the target directory (or files)
Try creating your own symlink and see what happens when you call it in the browser.
* Check this answer at askubuntu.com for more hints.
Ok I eventually solved it. In OSX the final file that governs access of sites installed in user directories is the last Include line in the apache2/conf/extra/httpd-userdir.conffile. Once I changed that my problems went away.
Thanks to all the people that replied my questions.
I have been trying to setup cakephp on an Amazon EC2 (Ubuntu) instance ..
however when i try running the code .. it shows no color, no
styles, no layout etc.
I have updated the httpd.conf with the following content ..
Options Indexes FollowSymLinks
AllowOverride All
It still doesnt seem to work.
What is it that am doing wrong ???
Regards
Abhishek Jain
I had the same problem. Found out that my .htaccess files didn't have the permission to override anything, because AllowOverride was set to none.
I looked for the value in my httpd.conf file under /etc/httpd/conf/ and changed it to All
<Directory "/var/www/html">
AllowOverride All
</Directory>
Not EC2 related but I had a simmilar issue on the Mac when installing CakePHP on Mamp. A complete delete of all the CakePHP files and a re-install solved the issue for me.
I don't have much too much experience installing Cake, but you should probably check the following anyway:
a) Do you have the correct .htaccess files in the correct directories? Linux treats anything that starts with '.' as a system file, so you have to do
ls -a
to check if they are present. If you moved the files into the directories manually, instead of unpacking the Cake download in the location you wanted it, the .htaccess files may not have been moved.
b) Check your Apache error logs (I assume you're using apache) for errors, especially errors loading mod_rewrite. Make sure LoadModule rewrite_module libexec/httpd/mod_rewrite.so and AddModule mod_rewrite.c are specified in httpd.conf.
c) Where did you put this?
Options Indexes FollowSymLinks AllowOverride All
Without seeing more of your httpd.conf, there's no way of telling whether the Cake document root is inheriting these settings correctly.