1 |
# $Id$ |
2 |
# Authority: shuff |
3 |
# Upstream: http://fastcgi.com/fastcgi-developers |
4 |
|
5 |
%{?el4:%define _without_selinux 1} |
6 |
%{?el3:%define _without_selinux 1} |
7 |
%{?rh9:%define _without_selinux 1} |
8 |
%{?rh7:%define _without_selinux 1} |
9 |
|
10 |
Summary: Apache module that enables FastCGI |
11 |
Name: mod_fastcgi |
12 |
Version: 2.4.6 |
13 |
Release: 3%{?dist} |
14 |
License: GPL/Apache License |
15 |
Group: System Environment/Daemons |
16 |
URL: http://www.fastcgi.com/ |
17 |
|
18 |
Packager: Steve Huff <shuff@vecna.org> |
19 |
Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ |
20 |
|
21 |
Source0: http://www.fastcgi.com/dist/mod_fastcgi-%{version}.tar.gz |
22 |
Source1: mod_fastcgi.te |
23 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root |
24 |
|
25 |
BuildRequires: autoconf |
26 |
BuildRequires: automake |
27 |
BuildRequires: gcc-c++ |
28 |
BuildRequires: httpd-devel >= 2.0 |
29 |
Requires: httpd >= 2.0 |
30 |
|
31 |
%{!?_without_selinux:BuildRequires: checkpolicy, policycoreutils} |
32 |
|
33 |
%description |
34 |
mod_fastcgi is a module for the Apache web server, that enables |
35 |
FastCGI - a standards based protocol for communicating with |
36 |
applications that generate dynamic content for web pages. |
37 |
|
38 |
%prep |
39 |
%setup -n %{name}-%{version} |
40 |
|
41 |
%build |
42 |
cp Makefile.AP2 Makefile |
43 |
%{__make} top_dir="%{_libdir}/httpd" |
44 |
|
45 |
%{__cat} <<EOF >fastcgi.httpd |
46 |
# WARNING: this is a kludge: |
47 |
## The User/Group for httpd need to be set before we can load mod_fastcgi, |
48 |
## but /etc/httpd/conf.d/fastcgi.conf on RHEL gets loaded before |
49 |
## /etc/httpd/conf/httpd.conf, so we need to set them here :( |
50 |
## mod_fcgid does not have this bug, |
51 |
## but it does not handle child PHP processes appropriately per |
52 |
## http://serverfault.com/questions/303535/a-single-php-fastcgi-process-blocks-all-other-php-requests/305093#305093 |
53 |
|
54 |
User apache |
55 |
Group apache |
56 |
|
57 |
LoadModule fastcgi_module modules/mod_fastcgi.so |
58 |
|
59 |
# dir for IPC socket files |
60 |
FastCgiIpcDir %{_localstatedir}/run/%{name} |
61 |
|
62 |
# wrap all fastcgi script calls in suexec |
63 |
FastCgiWrapper On |
64 |
|
65 |
# global FastCgiConfig can be overridden by FastCgiServer options in vhost config |
66 |
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1 |
67 |
|
68 |
# sample PHP config |
69 |
# see /usr/share/doc/mod_fastcgi-2.4.6 for php-wrapper script |
70 |
# don't forget to disable mod_php in /etc/httpd/conf.d/php.conf! |
71 |
# |
72 |
# to enable privilege separation, add a "SuexecUserGroup" directive |
73 |
# and chown the php-wrapper script and parent directory accordingly |
74 |
# see also http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/ |
75 |
# |
76 |
#FastCgiServer /var/www/cgi-bin/php-wrapper |
77 |
#AddHandler php-fastcgi .php |
78 |
#Action php-fastcgi /cgi-bin/php-wrapper |
79 |
#AddType application/x-httpd-php .php |
80 |
#DirectoryIndex index.php |
81 |
# |
82 |
#<Location /cgi-bin/php-wrapper> |
83 |
# Order Deny,Allow |
84 |
# Deny from All |
85 |
# Allow from env=REDIRECT_STATUS |
86 |
# Options ExecCGI |
87 |
# SetHandler fastcgi-script |
88 |
#</Location> |
89 |
EOF |
90 |
|
91 |
%{__cat} <<WRAPPER >php-wrapper |
92 |
#!/bin/sh |
93 |
|
94 |
PHPRC="/etc/php.ini" |
95 |
export PHPRC |
96 |
PHP_FCGI_CHILDREN=4 |
97 |
export PHP_FCGI_CHILDREN |
98 |
exec /usr/bin/php-cgi |
99 |
WRAPPER |
100 |
|
101 |
%{__chmod} +x php-wrapper |
102 |
|
103 |
%install |
104 |
%{__rm} -rf %{buildroot} |
105 |
%{__make} install top_dir="%{_libdir}/httpd" DESTDIR="%{buildroot}" |
106 |
%{__install} -Dp -m0644 fastcgi.httpd %{buildroot}%{_sysconfdir}/httpd/conf.d/fastcgi.conf |
107 |
|
108 |
# make an IPC sockets dir |
109 |
%{__install} -d -m770 %{buildroot}%{_localstatedir}/run/%{name} |
110 |
|
111 |
### set up SELinux module if called for (adapted from munin.spec) |
112 |
%if %{!?_without_selinux:1} |
113 |
checkmodule -M -m -o %{name}.mod %{SOURCE1} |
114 |
semodule_package -o %{name}.pp -m %{name}.mod |
115 |
%{__install} -D -d -m0755 %{buildroot}%{_datadir}/selinux/targeted/ |
116 |
%{__install} %{name}.pp %{buildroot}%{_datadir}/selinux/targeted/ |
117 |
%endif |
118 |
|
119 |
%clean |
120 |
%{__rm} -rf %{buildroot} |
121 |
|
122 |
%post |
123 |
%if %{!?_without_selinux:1} |
124 |
semodule -i %{_datadir}/selinux/targeted/%{name}.pp |
125 |
%endif |
126 |
|
127 |
%files |
128 |
%defattr(-, root, root, 0755) |
129 |
%doc CHANGES INSTALL* README docs/ php-wrapper |
130 |
%config(noreplace) %{_sysconfdir}/httpd/conf.d/fastcgi.conf |
131 |
%{_libdir}/httpd/modules/mod_fastcgi.so |
132 |
%dir %attr(770,apache,apache) %{_localstatedir}/run/%{name} |
133 |
%attr(0644, root, root) %{_datadir}/selinux/targeted/* |
134 |
|
135 |
%changelog |
136 |
* Wed Jul 26 2017 Daniel Berteaud <daniel@firewall-services.com> 2.4.6-3 |
137 |
- Rebuild for SME Server |
138 |
|
139 |
* Mon May 07 2012 William Horka <whorka@hmdc.harvard.edu> 2.4.6-2 |
140 |
- Add selinux module |
141 |
- Remove unused log dir and add IPC socket dir |
142 |
- Add FastCgiWrapper, FastCgiConfig, and FastCgiWrapper to fastcgi.conf |
143 |
- Set httpd User and Group in fastcgi.conf so mod_fastcgi.so will load |
144 |
|
145 |
* Fri Aug 26 2011 Philip Durbin <philipdurbin@gmail.com> 2.4.6-1 |
146 |
- Initial release, based on mod_suphp.spec |