Skip to content

Instantly share code, notes, and snippets.

@robertoschwald
Created August 19, 2020 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertoschwald/3317b4d777f44260fef86c5059955ffc to your computer and use it in GitHub Desktop.
Save robertoschwald/3317b4d777f44260fef86c5059955ffc to your computer and use it in GitHub Desktop.
mod_jk RPM Spec file for CentOS8
%{!?apxs: %{expand: %%define apxs %{_bindir}/apxs}}
%define httpd httpd
Name: mod_jk
Version: 1.2.48
Release: 1%{?org_tag}%{?dist}
Epoch: 0
Summary: Tomcat mod_jk connector for Apache
License: Apache License
Group: Internet/WWW/Servers
URL: http://tomcat.apache.org/
Source0: http://www.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-%{version}-src.tar.gz
Patch1: httpd-jk.conf-1.2.48.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: %{httpd}-devel, autoconf, automake, libtool, make
Requires: %{httpd}
Obsoletes: mod_jk < %{epoch}:%{version}-%{release}
Provides: mod_jk = %{epoch}:%{version}-%{release}
Obsoletes: tomcat-mod < %{epoch}:%{version}-%{release}
%description
mod_jk allows Apache to serve as a front-end for Tomcat, GlassFish or any other
AJP1.3-enabled application server, with optional load-balancing.
# --- sub-package for selinux support ---
%package selinux
Summary: Tomcat mod_jk connector for Apache SELinux support
Requires: %name = %version-%release
Requires: policycoreutils, libselinux-utils
Requires(post): policycoreutils, gawk
Requires(postun): policycoreutils
%description selinux
This package contains SELinux support for the httpd-mod_jk package.
#################################################################################
# common
#################################################################################
# httpd does not work with position independent executables (pie flag set)
# So we reconfigure the macro
%global _hardening_ldflags -Wl,-z,now
%prep
%setup -q -n tomcat-connectors-%{version}-src
%patch1 -p0 -b .org
(cd native && %{__libtoolize} --copy --force)
%build
export apxs=%{_httpd_apxs}
cd native
autoreconf -fi
%configure \
--with-apxs=%{apxs} \
make %{?_smp_mflags}
cd ..
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/%{httpd}/modules
mkdir -p %{buildroot}/%{httpd}/conf.d/
mkdir -p %{buildroot}/var/cache/httpd
%{__install} -D -m 755 native/apache-2.0/mod_jk.so %{buildroot}/%{_sysconfdir}/%{httpd}/modules/mod_jk.so
%{__install} -D -m 644 conf/workers.properties -D %{buildroot}/%{_sysconfdir}/%{httpd}/conf.d/workers.properties
%{__install} -D -m 644 conf/httpd-jk.conf -D %{buildroot}/%{_sysconfdir}/%{httpd}/conf.d/mod_jk.conf
#################################################################################
# files
#################################################################################
%files
%doc LICENSE NOTICE conf/workers.properties
%doc native/BUILDING.txt native/README.txt native/TODO.txt
%config(noreplace) /%{_sysconfdir}/%{httpd}/conf.d/mod_jk.conf
%config(noreplace) /%{_sysconfdir}/%{httpd}/conf.d/workers.properties
/%{_sysconfdir}/%{httpd}/modules/mod_jk.so
%files selinux
#################################################################################
%post selinux
restorecon %{_sysconfdir}/%{httpd}/modules/mod_jk.so > /dev/null 2>&1
restorecon /var/cache/httpd > /dev/null 2>&1
#################################################################################
%changelog
* Tue Aug 18 2020 Robert Oschwald <robertoschwald@gmail.com> - 0:1.2.48-1
- Version for Centos8
- Need to use without -pie flag, otherwise glibc does not load dynamic lib
* Wed Apr 20 2016 Robert Oschwald <robertoschwald@gmail.com> - 0:1.2.41-2
- Use /var/cache/httpd for shm file due to SELinux in CentOS7
* Wed Apr 20 2016 Robert Oschwald <robertoschwald@gmail.com> 0:1.2.41-1
- Version 1.2.41
- Added selinux sub-package for correct labling of mod_jk.so
* Tue Jun 18 2013 Vicente Dominguez <twitter:@vicendominguez> 1.2.37
- Initial release
@ghen2
Copy link

ghen2 commented Oct 13, 2020

What's in httpd-jk.conf-1.2.48.patch?

@robertoschwald
Copy link
Author

robertoschwald commented Oct 13, 2020

httpd-jk.conf-1.2.48.patch

--- conf/httpd-jk.conf.org	2014-12-20 15:04:28.000000000 -0500
+++ conf/httpd-jk.conf	2016-04-20 11:08:49.166566794 -0400
@@ -25,7 +25,7 @@

     # We need a workers file exactly once
     # and in the global server
-    JkWorkersFile conf/workers.properties
+    JkWorkersFile conf.d/workers.properties

     # Our JK error log
     # You can (and should) use rotatelogs here
@@ -35,7 +35,7 @@
     JkLogLevel info

     # Our JK shared memory file
-    JkShmFile logs/mod_jk.shm
+    JkShmFile /var/cache/httpd/mod_jk.shm

     # Define a new log format you can use in any CustomLog in order
     # to add mod_jk specific information to your access log.

@ghen2
Copy link

ghen2 commented Oct 13, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment