Last active
December 30, 2015 08:39
-
-
Save tkuchiki/7804414 to your computer and use it in GitHub Desktop.
spec ngx_openresty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add epel repo | |
yum install -y libdrizzle libdrizzle-devel pcre pcre-devel openssl openssl-devel zlib zlib-devel readline readline-devel libxml2 libxml2-devel libxslt-devel perl perl-devel perl-ExtUtils-Embed perl-ExtUtils-ParseXS GeoIP-devel gd-devel | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CentOS 5 は、perl-devel は不要。 | |
# /sbin にパスを通しておく(ldconfig) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%global nginx_service nginx | |
%global nginx_user nginx | |
%global nginx_group %{nginx_user} | |
%global nginx_home %{_localstatedir}/lib/nginx | |
%global nginx_tmp %{_localstatedir}/tmp/nginx | |
%global nginx_logdir %{_localstatedir}/log/nginx | |
%global nginx_cache %{_localstatedir}/cache/nginx | |
%global nginx_dir /opt/openresty | |
%global nginx_conf %{_sysconfdir}/nginx | |
%global nginx_webroot %{nginx_dir}/nginx/html | |
Name: ngx_openresty | |
Version: 1.4.3.6 | |
Release: 1%{?dist} | |
Summary: A fast web app server by extending nginx | |
Group: System Environment/Daemons | |
# BSD License (two clause) | |
# http://www.freebsd.org/copyright/freebsd-license.html | |
License: BSD | |
URL: http://openresty.org | |
Source0: http://openresty.org/download/ngx_openresty-%{version}.tar.gz | |
Source1: nginx.init | |
Source2: nginx.logrotate | |
Source3: nginx.conf | |
Source4: default.conf | |
Source5: ssl.conf | |
Source6: nginx.sysconfig | |
Source7: nginx.8 | |
Source100: index.html | |
Source101: 50x.html | |
BuildRequires: GeoIP-devel | |
BuildRequires: gd-devel | |
BuildRequires: libxslt-devel | |
BuildRequires: openssl-devel | |
BuildRequires: pcre-devel | |
BuildRequires: perl-devel | |
BuildRequires: perl(ExtUtils::Embed) | |
BuildRequires: zlib-devel | |
Requires: GeoIP | |
Requires: gd | |
Requires: openssl | |
Requires: pcre | |
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) | |
Requires(pre): shadow-utils | |
Requires(post): chkconfig | |
Requires(preun): chkconfig, initscripts | |
Requires(postun): initscripts | |
Provides: webserver | |
%undefine __check_files %{nil} | |
%description | |
A full-fledged web application server by bundling the standard Nginx core, | |
lots of 3rd-party Nginx modules, as well as most of their external dependencies. | |
%prep | |
%setup -q | |
%build | |
export DESTDIR=%{buildroot} | |
./configure \ | |
--prefix=%{nginx_dir} \ | |
--conf-path=%{nginx_conf}/nginx.conf \ | |
--sbin-path=%{_sbindir}/nginx \ | |
--http-log-path=%{nginx_logdir}/access.log \ | |
--error-log-path=%{nginx_logdir}/error.log \ | |
--pid-path=%{_localstatedir}/run/nginx.pid \ | |
--lock-path=%{_localstatedir}/lock/subsys/nginx \ | |
--http-client-body-temp-path=%{nginx_tmp}/client_body \ | |
--http-proxy-temp-path=%{nginx_tmp}/proxy \ | |
--http-fastcgi-temp-path=%{nginx_cache}/fastcgi_temp \ | |
--http-uwsgi-temp-path=%{nginx_cache}/uwsgi_temp \ | |
--http-scgi-temp-path=%{nginx_cache}/scgi_temp \ | |
--user=%{nginx_user} \ | |
--group=%{nginx_group} \ | |
--with-file-aio \ | |
--with-ipv6 \ | |
--with-http_ssl_module \ | |
--with-http_realip_module \ | |
--with-http_addition_module \ | |
--with-http_xslt_module \ | |
--with-http_image_filter_module \ | |
--with-http_geoip_module \ | |
--with-http_sub_module \ | |
--with-http_dav_module \ | |
--with-http_flv_module \ | |
--with-http_mp4_module \ | |
--with-http_gzip_static_module \ | |
--with-http_random_index_module \ | |
--with-http_secure_link_module \ | |
--with-http_degradation_module \ | |
--with-http_stub_status_module \ | |
--with-http_perl_module \ | |
--with-http_iconv_module \ | |
--with-http_drizzle_module \ | |
--with-mail \ | |
--with-mail_ssl_module \ | |
--with-luajit | |
gmake | |
%install | |
rm -rf %{buildroot} | |
gmake install DESTDIR=%{buildroot} INSTALLDIRS=vendor | |
find %{buildroot} -type f -name .packlist -exec rm -f '{}' \; | |
find %{buildroot} -type f -name perllocal.pod -exec rm -f '{}' \; | |
find %{buildroot} -type f -empty -exec rm -f '{}' \; | |
find %{buildroot} -type f -iname '*.so' -exec chmod 0755 '{}' \; | |
install -p -D -m 0755 %{SOURCE1} \ | |
%{buildroot}%{_initrddir}/nginx | |
install -p -D -m 0644 %{SOURCE2} \ | |
%{buildroot}%{_sysconfdir}/logrotate.d/nginx | |
install -p -D -m 0644 %{SOURCE6} \ | |
%{buildroot}%{_sysconfdir}/sysconfig/nginx | |
install -p -d -m 0755 %{buildroot}%{nginx_dir} | |
install -p -d -m 0755 %{buildroot}%{nginx_conf}/conf.d | |
install -p -d -m 0755 %{buildroot}%{nginx_tmp}/{client,proxy} | |
install -p -d -m 0700 %{buildroot}%{nginx_cache}/{fastcgi,scgi,uwsgi}_temp | |
install -p -d -m 0700 %{buildroot}%{nginx_home} | |
install -p -d -m 0700 %{buildroot}%{nginx_logdir} | |
install -p -d -m 0755 %{buildroot}%{nginx_webroot} | |
install -p -m 0644 %{SOURCE3} \ | |
%{buildroot}%{nginx_conf} | |
install -p -m 0644 %{SOURCE4} %{SOURCE5} \ | |
%{buildroot}%{nginx_conf}/conf.d | |
install -p -m 0644 %{SOURCE100} \ | |
%{buildroot}%{nginx_webroot} | |
install -p -m 0644 %{SOURCE101} \ | |
%{buildroot}%{nginx_webroot} | |
install -p -D -m 0644 %{SOURCE7} \ | |
%{buildroot}%{_mandir}/man8/nginx.8 | |
rm -rf %{nginx_dir} | |
%pre | |
getent group %{nginx_group} > /dev/null || groupadd -r %{nginx_group} | |
getent passwd %{nginx_user} > /dev/null || \ | |
useradd -r -d %{nginx_home} -g %{nginx_group} \ | |
-s /sbin/nologin -c "Nginx web server" %{nginx_user} | |
exit 0 | |
%post | |
if [ $1 -eq 1 ]; then | |
/sbin/chkconfig --add %{nginx_service} | |
fi | |
if [ $1 -eq 2 ]; then | |
# Make sure these directories are not world readable. | |
chmod 700 %{nginx_home} | |
fi | |
%preun | |
if [ $1 -eq 0 ]; then | |
/sbin/service %{nginx_bin} stop >/dev/null 2>&1 | |
/sbin/chkconfig --del %{nginx_service} | |
fi | |
%postun | |
if [ $1 -eq 2 ]; then | |
/sbin/service %{nginx_service} upgrade || : | |
fi | |
%files | |
%{nginx_dir}/luajit/ | |
%{nginx_dir}/lualib/ | |
%{nginx_webroot}/ | |
%{_sbindir}/nginx | |
%{_mandir}/man8/nginx.8* | |
%{_initrddir}/nginx | |
%config(noreplace) %{nginx_conf}/*.conf | |
%config(noreplace) %{nginx_conf}/*.default | |
%config(noreplace) %{nginx_conf}/fastcgi_params | |
%config(noreplace) %{nginx_conf}/koi-utf | |
%config(noreplace) %{nginx_conf}/koi-win | |
%config(noreplace) %{nginx_conf}/mime.types | |
%config(noreplace) %{nginx_conf}/scgi_params | |
%config(noreplace) %{nginx_conf}/uwsgi_params | |
%config(noreplace) %{nginx_conf}/win-utf | |
%config(noreplace) %{nginx_conf}/conf.d/*.conf | |
%config(noreplace) %{_sysconfdir}/logrotate.d/nginx | |
%config(noreplace) %{_sysconfdir}/sysconfig/nginx | |
%dir %{perl_vendorarch}/auto/nginx | |
%{perl_vendorarch}/nginx.pm | |
%{perl_vendorarch}/auto/nginx/nginx.so | |
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_home} | |
%attr(755,%{nginx_user},%{nginx_group}) %dir %{nginx_tmp}/client | |
%attr(755,%{nginx_user},%{nginx_group}) %dir %{nginx_tmp}/proxy | |
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_cache}/fastcgi_temp | |
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_cache}/scgi_temp | |
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_cache}/uwsgi_temp | |
%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment