remove requirements for apache, added configuration for nginx [release 4.4.14-2mamba;Sat Aug 12 2023]

This commit is contained in:
Silvan Calarco 2024-01-06 07:30:42 +01:00
parent a47098ca4b
commit 4688ba83b4
2 changed files with 40 additions and 22 deletions

24
nagios-nginx.conf Normal file
View File

@ -0,0 +1,24 @@
server {
server_name nagios.your-domain.com;
root /usr/share/nagios/html;
listen 80;
index index.php index.html index.htm;
access_log /var/log/nginx/nagios.access.log;
error_log /var/log/nginx/nagios.error.log; auth_basic "Nagios Access";
auth_basic_user_file /etc/nagios/private/htpasswd.users;
add_header X-Frame-Options "ALLOW"; location ~ \.php$ {
try_files $uri = 404;
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi.conf;
} location ~ \.cgi$ {
root /usr/lib64/nagios/cgi-bin;
rewrite ^/nagios/cgi-bin/(.*)\.cgi /$1.cgi break;
fastcgi_param AUTH_USER $remote_user;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi.conf;
fastcgi_pass unix:/run/fcgiwrap.socket;
} # Fixes the fact some links are expected to resolve to /nagios, see here.
location /nagios {
alias /usr/share/nagios/html;
}}

View File

@ -4,7 +4,7 @@
Name: nagios Name: nagios
Version: 4.4.14 Version: 4.4.14
Release: 1mamba Release: 2mamba
Summary: An Open Source host, service and network monitoring program Summary: An Open Source host, service and network monitoring program
Group: Network/Monitoring Group: Network/Monitoring
Vendor: openmamba Vendor: openmamba
@ -14,6 +14,7 @@ URL: https://www.nagios.org/
Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz Source0: http://downloads.sourceforge.net/sourceforge/nagios/nagios-%{version}.tar.gz
Source1: nagios.htaccess Source1: nagios.htaccess
Source2: nagios.service Source2: nagios.service
Source3: nagios-nginx.conf
Patch0: %{name}-3.4.2-nagios_initscripts.patch Patch0: %{name}-3.4.2-nagios_initscripts.patch
Patch1: %{name}-3.4.2-makefile_install,patch Patch1: %{name}-3.4.2-makefile_install,patch
Patch2: %{name}-3.4.2-fix_path_to_cgi_executables.patch Patch2: %{name}-3.4.2-fix_path_to_cgi_executables.patch
@ -54,8 +55,6 @@ This package provide core programs for nagios.
Group: Network/Monitoring Group: Network/Monitoring
Summary: Provides the HTML and CGI files for the Nagios web interface Summary: Provides the HTML and CGI files for the Nagios web interface
Requires(pre): %{name} = %{?epoch:%epoch:}%{version}-%{release} Requires(pre): %{name} = %{?epoch:%epoch:}%{version}-%{release}
Requires(pre): apache
Requires(pre): apache-mod_php
%description www %description www
Nagios is an application, system and network monitoring application. Nagios is an application, system and network monitoring application.
@ -202,6 +201,11 @@ install -d %{buildroot}%{_sysconfdir}/nagios/conf.d
#install -D -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/nagios.service #install -D -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/nagios.service
#rm -f %{buildroot}%{_initrddir}/nagios #rm -f %{buildroot}%{_initrddir}/nagios
mv %{buildroot}%{_sysconfdir}/httpd/httpd.d/nagios.conf{,.example}
# install nginx sample site configuration
install -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nginx/sites-available/nagios.conf.example
%clean %clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot} [ "%{buildroot}" != / ] && rm -rf %{buildroot}
@ -239,28 +243,16 @@ fi
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \; find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
: :
%preun www
if [ $1 = 0 ]; then
[ -e %{_localstatedir}/lock/subsys/httpd ] && /sbin/service httpd reload 2>&1
fi
exit 0
%post www %post www
if [ $1 -eq 1 ]; then if [ $1 -eq 1 ]; then
RANDOM_PASSWD=`/usr/bin/mkpasswd -l 10 -s 0 2>/dev/null` RANDOM_PASSWD=`/usr/bin/mkpasswd -l 10 -s 0 2>/dev/null`
%{_bindir}/htpasswd \ %{_bindir}/htpasswd \
-bc %{_sysconfdir}/%{name}/private/htpasswd.users nagiosadmin \ -bc %{_sysconfdir}/%{name}/private/htpasswd.users nagiosadmin \
$RANDOM_PASSWD >/dev/null 2>&1 $RANDOM_PASSWD >/dev/null 2>&1
groupmod nagios -A apache #groupmod nagios -A apache
systemctl -q reload httpd || : #systemctl -q reload httpd || :
fi fi
exit 0 :
%postun www
if [ $1 -ge 1 ]; then
systemctl -q reload httpd || :
fi
exit 0
%files %files
%defattr(-,root,root) %defattr(-,root,root)
@ -285,14 +277,13 @@ exit 0
%files www %files www
%defattr(-,root,root) %defattr(-,root,root)
%{_sysconfdir}/httpd/httpd.d/nagios.conf.example
%{_sysconfdir}/nginx/sites-available/nagios.conf.example
%attr(0640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/%{name}/private/htpasswd.users
%dir %{_datadir}/%{name}/html %dir %{_datadir}/%{name}/html
%{_datadir}/%{name}/html/* %{_datadir}/%{name}/html/*
#%config(noreplace) %{_datadir}/%{name}/html/config.inc.php
#%config(noreplace) %{_datadir}/%{name}/html/images/sblogo.png
%dir %{_libdir}/nagios/cgi-bin %dir %{_libdir}/nagios/cgi-bin
%{_libdir}/nagios/cgi-bin/* %{_libdir}/nagios/cgi-bin/*
%config(noreplace) %{_sysconfdir}/httpd/httpd.d/nagios.conf
%attr(0640,root,%{nsgrp}) %config(noreplace) %{_sysconfdir}/%{name}/private/htpasswd.users
%files devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
@ -303,6 +294,9 @@ exit 0
%{_libdir}/nagios/libnagios.a %{_libdir}/nagios/libnagios.a
%changelog %changelog
* Sat Aug 12 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 4.4.14-2mamba
- remove requirements for apache, added configuration for nginx
* Wed Aug 02 2023 Automatic Build System <autodist@mambasoft.it> 4.4.14-1mamba * Wed Aug 02 2023 Automatic Build System <autodist@mambasoft.it> 4.4.14-1mamba
- automatic version update by autodist - automatic version update by autodist