ABHIONLINUX
Site useful for linux administration and web hosting

2009/11/22

Make PHP to work in your HTML files with .htacess

By default most web servers across the internet are configured to treat as PHP files only files that end with .php. In case you need to have your HTML files parsed as PHP (e.g .html) or even if you want to take it further and make your PHP files look like ASP, you can do the following:

For web servers using PHP as apache module:

AddType application/x-httpd-php .html .htm

For web servers running PHP as CGI:

AddHandler application/x-httpd-php .html .htm

In case you wish to do the ASP mimick:

For PHP as module:

AddType application/x-httpd-php .asp

OR

For PHP as CGI:

AddHandler application/x-httpd-php .asp

2009/11/16

Installing nagios in the server

Installing Nagios:



1. Download tar ball from www.nagios.org extract it
2. Go to the extracted directory and give following commands:

# ./configure --prefix=/usr/local/nagios

# make all

##### create nagios user and group###

# groupadd nagios

# adduser -g nagios nagios

# passwd nagios -------> set passwd to nagios

##### Give following cmds ###

# make install

# make install-init

# make install-commandmode

# make install-config

3. Create dir nagios in your documentroot of http server. For example: your docroot
is /var/www/html then create diirectory

mkdir /var/www/html/nagios

4. Change owner and group to nagios:nagios

chown nagios:nagios

5. cp -ap /usr/local/nagios/share/* /var/www/html/nagios

6. Now check in your browser http://localhost/nagios

7. remove "sample" from filenames of all configuration files which are under /usr/local/nagios/etc/

8. open /usr/local/nagios/etc/cgi.cfg and replace following line

physical_html_path=/usr/local/nagios/share ----------> to -------->

physical_html_path=/var/www/html/nagios

use_authentication=1 -------> to ---------> use-authentication=0


9. mkdir /var/www/html/nagios/cgi-bin

10. chown nagios:nagios /var/www/html/nagios/cgi-bin

11. cp -ap /usr/local/nagios/sbin/* /var/www/html/nagios/cgi-bin

12. in httpd.conf add following line:

ScriptAlias /nagios/cgi-bin/ "/var/www/html/nagios/cgi-bin/" ------> PLEASE DO NOT
FORGET to GIVE "/" in the END.

13. Restart Apache

14. Start nagios deamon

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg ------> For testing conf

/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg -d &

15. Check nagios is started or not

ps -ef|grep nagios

16. Check again in your browser http://localhost/nagios and try clicking on different "menus in side
bar." It shuld show you some status.

17. Installing nagios plugins -->

18. untar nagios-plugins tarball.

19. go to that directory and execute following commands:

./configure --prefix=/usr/local/nagios/

make

make install

20. It will install nagios-plugins in following dir : /usr/local/nagios/libexec/

21. For refreshing nagios deamon:

killall -HUP /usr/local/nagios/bin/nagios