diff --git a/nginx.init b/nginx.init deleted file mode 100644 index 094fc65..0000000 --- a/nginx.init +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh -# -# nginx - this script starts and stops the nginx daemon -# -# chkconfig: - 85 15 -# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ -# proxy and IMAP/POP3 proxy server -# processname: nginx -# config: /etc/nginx/nginx.conf -# config: /etc/sysconfig/nginx -# pidfile: /var/run/nginx.pid - -# Source function library. -. /etc/rc.d/init.d/functions - -# Source networking configuration. -. /etc/sysconfig/network - -# Check that networking is up. -[ "$NETWORKING" = "no" ] && exit 0 - -nginx="/usr/sbin/nginx" -prog=$(basename $nginx) - -sysconfig="/etc/sysconfig/$prog" -lockfile="/var/lock/subsys/nginx" -pidfile="/var/run/${prog}.pid" - -NGINX_CONF_FILE="/etc/nginx/nginx.conf" - -[ -f $sysconfig ] && . $sysconfig - - -start() { - [ -x $nginx ] || exit 5 - [ -f $NGINX_CONF_FILE ] || exit 6 - echo -n $"Starting $prog: " - daemon $nginx -c $NGINX_CONF_FILE - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - echo -n $"Stopping $prog: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - configtest_q || return 6 - stop - start -} - -reload() { - configtest_q || return 6 - echo -n $"Reloading $prog: " - killproc -p $pidfile $prog -HUP - echo -} - -configtest() { - $nginx -t -c $NGINX_CONF_FILE -} - -configtest_q() { - $nginx -t -q -c $NGINX_CONF_FILE -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -# Upgrade the binary with no downtime. -upgrade() { - local oldbin_pidfile="${pidfile}.oldbin" - - configtest_q || return 6 - echo -n $"Upgrading $prog: " - killproc -p $pidfile $prog -USR2 - retval=$? - sleep 1 - if [[ -f ${oldbin_pidfile} && -f ${pidfile} ]]; then - killproc -p $oldbin_pidfile $prog -QUIT - success $"$prog online upgrade" - echo - return 0 - else - failure $"$prog online upgrade" - echo - return 1 - fi -} - -# Tell nginx to reopen logs -reopen_logs() { - configtest_q || return 6 - echo -n $"Reopening $prog logs: " - killproc -p $pidfile $prog -USR1 - retval=$? - echo - return $retval -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart|configtest|reopen_logs) - $1 - ;; - force-reload|upgrade) - rh_status_q || exit 7 - upgrade - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - status|status_q) - rh_$1 - ;; - condrestart|try-restart) - rh_status_q || exit 7 - restart - ;; - *) - echo $"Usage: $0 {start|stop|reload|configtest|status|force-reload|upgrade|restart|reopen_logs}" - exit 2 -esac diff --git a/nginx.service b/nginx.service new file mode 100644 index 0000000..cf6f62f --- /dev/null +++ b/nginx.service @@ -0,0 +1,13 @@ +[Unit] +Description=A high performance web server and reverse proxy server + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf +ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf +ExecReload=/usr/sbin/nginx -c /etc/nginx/nginx.conf -s reload +ExecStop=/usr/sbin/nginx -s quit + +[Install] +WantedBy=multi-user.target diff --git a/nginx.spec b/nginx.spec index 2ceec4d..798cd28 100644 --- a/nginx.spec +++ b/nginx.spec @@ -1,76 +1,82 @@ -%define nginx_user nginx -%define nginx_group %{nginx_user} -%define nginx_home %{_localstatedir}/lib/nginx -%define nginx_home_tmp %{nginx_home}/tmp -%define nginx_logdir %{_localstatedir}/log/nginx -%define nginx_confdir %{_sysconfdir}/nginx -%define nginx_datadir %{_datadir}/nginx -%define nginx_webroot %{nginx_datadir}/html +%global nginx_user nginx +%global nginx_group %{nginx_user} +%global nginx_home %{_localstatedir}/lib/nginx +%global nginx_home_tmp %{nginx_home}/tmp +%global nginx_confdir %{_sysconfdir}/nginx +%global nginx_datadir %{_datadir}/nginx +%global nginx_logdir %{_localstatedir}/log/nginx +%global nginx_webroot %{nginx_datadir}/html -Name: nginx -Version: 1.0.12 -Release: 1%{?dist} -Summary: Robust, small and high performance HTTP and reverse proxy server -Group: System Environment/Daemons +Name: nginx +Epoch: 1 +Version: 1.0.12 +Release: 2%{?dist} +Summary: A high performance web server and reverse proxy server +Group: System Environment/Daemons # BSD License (two clause) # http://www.freebsd.org/copyright/freebsd-license.html -License: BSD -URL: http://nginx.net/ -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +License: BSD +URL: http://nginx.org/ -BuildRequires: pcre-devel,zlib-devel,openssl-devel,perl-devel,perl(ExtUtils::Embed) -BuildRequires: libxslt-devel,GeoIP-devel,gd-devel -Requires: pcre,openssl,GeoIP,gd -Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) -# for /usr/sbin/useradd -Requires(pre): shadow-utils -Requires(post): chkconfig -# for /sbin/service -Requires(preun): chkconfig, initscripts -Requires(postun): initscripts -Provides: webserver - -Source0: http://nginx.org/download/nginx-%{version}.tar.gz -Source1: %{name}.init -Source2: %{name}.logrotate -Source3: virtual.conf -Source4: ssl.conf -Source5: %{name}.sysconfig -Source6: nginx.conf -Source7: default.conf -Source100: index.html -Source101: poweredby.png -Source102: nginx-logo.png -Source103: 50x.html -Source104: 404.html +Source0: http://nginx.org/download/nginx-%{version}.tar.gz +Source1: nginx.service +Source2: nginx.logrotate +Source3: nginx.conf +Source4: default.conf +Source5: ssl.conf +Source6: virtual.conf +Source100: index.html +Source101: poweredby.png +Source102: nginx-logo.png +Source103: 404.html +Source104: 50x.html # removes -Werror in upstream build scripts. -Werror conflicts with # -D_FORTIFY_SOURCE=2 causing warnings to turn into errors. -Patch0: nginx-auto-cc-gcc.patch +Patch0: nginx-auto-cc-gcc.patch + +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 +BuildRequires: systemd-units +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, systemd-units +Requires(preun): chkconfig, initscripts, systemd-units +Requires(postun): initscripts, systemd-units +Provides: webserver %description -Nginx [engine x] is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 -proxy server written by Igor Sysoev. +Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and +IMAP protocols, with a strong focus on high concurrency, performance and low +memory usage. + %prep %setup -q - %patch0 -p0 + %build # nginx does not utilize a standard configure script. It has its own # and the standard configure options cause the nginx configure script # to error out. This is is also the reason for the DESTDIR environment -# variable. The configure script(s) have been patched (Patch1 and -# Patch2) in order to support installing into a build environment. +# variable. export DESTDIR=%{buildroot} ./configure \ - --user=%{nginx_user} \ - --group=%{nginx_group} \ --prefix=%{nginx_datadir} \ - --sbin-path=%{_sbindir}/%{name} \ - --conf-path=%{nginx_confdir}/%{name}.conf \ + --sbin-path=%{_sbindir}/nginx \ + --conf-path=%{nginx_confdir}/nginx.conf \ --error-log-path=%{nginx_logdir}/error.log \ --http-log-path=%{nginx_logdir}/access.log \ --http-client-body-temp-path=%{nginx_home_tmp}/client_body \ @@ -78,8 +84,12 @@ export DESTDIR=%{buildroot} --http-fastcgi-temp-path=%{nginx_home_tmp}/fastcgi \ --http-uwsgi-temp-path=%{nginx_home_tmp}/uwsgi \ --http-scgi-temp-path=%{nginx_home_tmp}/scgi \ - --pid-path=%{_localstatedir}/run/%{name}.pid \ - --lock-path=%{_localstatedir}/lock/subsys/%{name} \ + --pid-path=%{_localstatedir}/run/nginx.pid \ + --lock-path=%{_localstatedir}/lock/subsys/nginx \ + --user=%{nginx_user} \ + --group=%{nginx_group} \ + --with-file-aio \ + --with-ipv6 \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ @@ -97,109 +107,132 @@ export DESTDIR=%{buildroot} --with-http_stub_status_module \ --with-http_perl_module \ --with-mail \ - --with-file-aio \ --with-mail_ssl_module \ - --with-ipv6 \ --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ --with-ld-opt="-Wl,-E" # so the perl module finds its symbols + make %{?_smp_mflags} + %install -rm -rf %{buildroot} make 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 -exec chmod 0644 {} \; -find %{buildroot} -type f -name '*.so' -exec chmod 0755 {} \; -chmod 0755 %{buildroot}%{_sbindir}/nginx -%{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} -%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} -%{__install} -p -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%{__install} -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d -%{__install} -p -m 0644 %{SOURCE3} %{SOURCE4} %{SOURCE7} %{buildroot}%{nginx_confdir}/conf.d -%{__install} -p -m 0644 %{SOURCE6} %{buildroot}%{nginx_confdir} -%{__install} -p -d -m 0755 %{buildroot}%{nginx_home_tmp} -%{__install} -p -d -m 0755 %{buildroot}%{nginx_logdir} -%{__install} -p -d -m 0755 %{buildroot}%{nginx_webroot} -%{__install} -p -m 0644 %{SOURCE100} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{buildroot}%{nginx_webroot} -# convert to UTF-8 all files that give warnings. -for textfile in CHANGES -do - mv $textfile $textfile.old - iconv --from-code ISO8859-1 --to-code UTF-8 --output $textfile $textfile.old - rm -f $textfile.old -done +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 0644 %{SOURCE1} \ + %{buildroot}%{_unitdir}/nginx.service +install -p -D -m 0644 %{SOURCE2} \ + %{buildroot}%{_sysconfdir}/logrotate.d/nginx + +install -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d +install -p -d -m 0755 %{buildroot}%{nginx_home_tmp} +install -p -d -m 0755 %{buildroot}%{nginx_logdir} +install -p -d -m 0755 %{buildroot}%{nginx_webroot} + +install -p -m 0644 %{SOURCE3} \ + %{buildroot}%{nginx_confdir} +install -p -m 0644 %{SOURCE4} %{SOURCE5} %{SOURCE6} \ + %{buildroot}%{nginx_confdir}/conf.d +install -p -m 0644 %{SOURCE100} \ + %{buildroot}%{nginx_webroot} +install -p -m 0644 %{SOURCE101} %{SOURCE102} \ + %{buildroot}%{nginx_webroot} +install -p -m 0644 %{SOURCE103} %{SOURCE104} \ + %{buildroot}%{nginx_webroot} -%clean -rm -rf %{buildroot} %pre -if [ $1 == 1 ]; then - %{_sbindir}/useradd -c "Nginx user" -s /bin/false -r -d %{nginx_home} %{nginx_user} 2>/dev/null || : +if [ $1 -eq 1 ]; then + getent group %{nginx_group} > /dev/null || groupadd -r %{nginx_group} + getent passwd %{nginx_user} > /dev/null || \ + useradd -r -d %{nginx_home} \ + -s /sbin/nologin -c "Nginx web server" %{nginx_user} + exit 0 fi %post -if [ $1 == 1 ]; then - /sbin/chkconfig --add %{name} +if [ $1 -eq 1 ]; then + /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi +%triggerun -- nginx < 1:1.0.12-2 +if /sbin/chkconfig --level 3 nginx; then + /bin/systemctl enable nginx.service >/dev/null 2>&1 || : +fi +/sbin/chkconfig --del nginx >/dev/null 2>&1 || : +/bin/systemctl try-restart nginx.service >/dev/null 2>&1 || : + %preun -if [ $1 = 0 ]; then - /sbin/service %{name} stop >/dev/null 2>&1 - /sbin/chkconfig --del %{name} +if [ $1 -eq 0 ]; then + /bin/systemctl --no-reload disable nginx.service >/dev/null 2>&1 || : + /bin/systemctl stop nginx.service >/dev/null 2>&1 || : fi %postun -if [ $1 == 2 ]; then - /sbin/service %{name} upgrade || : +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -gt 1 ]; then + /bin/systemctl try-restart nginx.service >/dev/null 2>&1 || : fi + %files -%defattr(-,root,root,-) %doc LICENSE CHANGES README %{nginx_datadir}/ -%{_sbindir}/%{name} -%{_mandir}/man3/%{name}.3pm.gz -%{_initrddir}/%{name} +%{_sbindir}/nginx +%{_mandir}/man3/nginx.3pm.gz +%{_unitdir}/nginx.service %dir %{nginx_confdir} %dir %{nginx_confdir}/conf.d %dir %{nginx_logdir} -%config(noreplace) %{nginx_confdir}/conf.d/*.conf -%config(noreplace) %{nginx_confdir}/win-utf -%config(noreplace) %{nginx_confdir}/%{name}.conf.default -%config(noreplace) %{nginx_confdir}/mime.types.default %config(noreplace) %{nginx_confdir}/fastcgi.conf %config(noreplace) %{nginx_confdir}/fastcgi.conf.default %config(noreplace) %{nginx_confdir}/fastcgi_params %config(noreplace) %{nginx_confdir}/fastcgi_params.default +%config(noreplace) %{nginx_confdir}/koi-utf +%config(noreplace) %{nginx_confdir}/koi-win +%config(noreplace) %{nginx_confdir}/mime.types +%config(noreplace) %{nginx_confdir}/mime.types.default +%config(noreplace) %{nginx_confdir}/nginx.conf +%config(noreplace) %{nginx_confdir}/nginx.conf.default %config(noreplace) %{nginx_confdir}/scgi_params %config(noreplace) %{nginx_confdir}/scgi_params.default %config(noreplace) %{nginx_confdir}/uwsgi_params %config(noreplace) %{nginx_confdir}/uwsgi_params.default -%config(noreplace) %{nginx_confdir}/koi-win -%config(noreplace) %{nginx_confdir}/koi-utf -%config(noreplace) %{nginx_confdir}/%{name}.conf -%config(noreplace) %{nginx_confdir}/mime.types -%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} -%config(noreplace) %{_sysconfdir}/sysconfig/%{name} -%dir %{perl_vendorarch}/auto/%{name} -%{perl_vendorarch}/%{name}.pm -%{perl_vendorarch}/auto/%{name}/%{name}.so +%config(noreplace) %{nginx_confdir}/win-utf +%config(noreplace) %{nginx_confdir}/conf.d/*.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/nginx +%dir %{perl_vendorarch}/auto/nginx +%{perl_vendorarch}/nginx.pm +%{perl_vendorarch}/auto/nginx/nginx.so %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home} %attr(-,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp} %changelog +* Mon Feb 20 2012 Jamie Nguyen 1:1.0.12-2 +- update upstream URL +- replace %%define with %%global +- remove obsolete BuildRoot tag, %%clean section and %%defattr +- remove various unnecessary commands +- add systemd service file and update scriptlets +- add Epoch to accommodate %%triggerun as part of systemd migration + * Sun Feb 19 2012 Jeremy Hinegardner - 1.0.12-1 -- UPdate to 1.0.12 +- Update to 1.0.12 -* Fri Feb 10 2012 Petr Pisar - 1.0.0-5 -- Rebuild against PCRE 8.30 +* Thu Nov 17 2011 Keiran "Affix" Smith - 1.0.10-1 +- Bugfix: a segmentation fault might occur in a worker process if resolver got a big DNS response. Thanks to Ben Hawkes. +- Bugfix: in cache key calculation if internal MD5 implementation wasused; the bug had appeared in 1.0.4. +- Bugfix: the module ngx_http_mp4_module sent incorrect "Content-Length" response header line if the "start" argument was used. Thanks to Piotr Sikora. -* Fri Jan 13 2012 Fedora Release Engineering - 1.0.0-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild +* Thu Oct 27 2011 Keiran "Affix" Smith - 1.0.8-1 +- Update to new 1.0.8 stable release + +* Fri Aug 26 2011 Keiran "Affix" Smith - 1.0.5-1 +- Update nginx to Latest Stable Release * Fri Jun 17 2011 Marcela Mašláňová - 1.0.0-3 - Perl mass rebuild diff --git a/nginx.sysconfig b/nginx.sysconfig deleted file mode 100644 index 8ba359b..0000000 --- a/nginx.sysconfig +++ /dev/null @@ -1,4 +0,0 @@ -# Configuration file for the nginx service - -# set this to the location of the nginx configuration file -NGINX_CONF_FILE=/etc/nginx/nginx.conf diff --git a/ssl.conf b/ssl.conf index e5bbce1..f958376 100644 --- a/ssl.conf +++ b/ssl.conf @@ -13,7 +13,7 @@ # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; -# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; +# ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / {