diff --git a/SOURCES/404.html b/SOURCES/404.html new file mode 100755 index 0000000..3e5b87c --- /dev/null +++ b/SOURCES/404.html @@ -0,0 +1,119 @@ + + + + + The page is not found + + + + + +

nginx error!

+ +
+ +

The page you are looking for is not found.

+ +
+

Website Administrator

+
+

Something has triggered missing webpage on your + website. This is the default 404 error page for + nginx that is distributed with + Fedora. It is located + /usr/share/nginx/html/404.html

+ +

You should customize this error page for your own + site or edit the error_page directive in + the nginx configuration file + /etc/nginx/nginx.conf.

+ +
+
+ +
+ [ Powered by nginx ] + + [ Powered by Fedora ] +
+
+ + diff --git a/SOURCES/50x.html b/SOURCES/50x.html new file mode 100755 index 0000000..5706d23 --- /dev/null +++ b/SOURCES/50x.html @@ -0,0 +1,119 @@ + + + + + The page is temporarily unavailable + + + + + +

nginx error!

+ +
+ +

The page you are looking for is temporarily unavailable. Please try again later.

+ +
+

Website Administrator

+
+

Something has triggered an error on your + website. This is the default error page for + nginx that is distributed with + Fedora. It is located + /usr/share/nginx/html/50x.html

+ +

You should customize this error page for your own + site or edit the error_page directive in + the nginx configuration file + /etc/nginx/nginx.conf.

+ +
+
+ +
+ [ Powered by nginx ] + + [ Powered by Fedora ] +
+
+ + diff --git a/SOURCES/nginx-auto-cc-gcc.patch b/SOURCES/nginx-auto-cc-gcc.patch new file mode 100755 index 0000000..ff693dc --- /dev/null +++ b/SOURCES/nginx-auto-cc-gcc.patch @@ -0,0 +1,13 @@ +--- auto/cc/gcc.orig 2007-03-22 08:34:53.000000000 -0600 ++++ auto/cc/gcc 2007-03-22 08:58:47.000000000 -0600 +@@ -172,7 +172,9 @@ + + + # stop on warning +-CFLAGS="$CFLAGS -Werror" ++# This combined with Fedora's FORTIFY_SOURCE=2 option causes it nginx ++# to not compile. ++#CFLAGS="$CFLAGS -Werror" + + # debug + CFLAGS="$CFLAGS -g" diff --git a/SOURCES/nginx-logo.png b/SOURCES/nginx-logo.png new file mode 100755 index 0000000..7406ba5 Binary files /dev/null and b/SOURCES/nginx-logo.png differ diff --git a/SOURCES/nginx-upgrade b/SOURCES/nginx-upgrade new file mode 100755 index 0000000..70f71e5 --- /dev/null +++ b/SOURCES/nginx-upgrade @@ -0,0 +1,13 @@ +#!/bin/sh +[ ! -f /run/nginx.pid ] && exit 1 +echo "Start new nginx master..." +/bin/systemctl kill --signal=SIGUSR2 nginx.service +sleep 5 +[ ! -f /run/nginx.pid.oldbin ] && sleep 5 +if [ ! -f /run/nginx.pid.oldbin ]; then + echo "Failed to start new nginx master." + exit 1 +fi +echo "Stop old nginx master gracefully..." +oldpid=`cat /run/nginx.pid.oldbin 2>/dev/null` +/bin/kill -s QUIT $oldpid 2>/dev/null diff --git a/SOURCES/nginx-upgrade.8 b/SOURCES/nginx-upgrade.8 new file mode 100755 index 0000000..2a435ab --- /dev/null +++ b/SOURCES/nginx-upgrade.8 @@ -0,0 +1,151 @@ +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.ie \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.el \{\ +. de IX +.. +.\} +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "NGINX-UPGRADE 8" +.TH NGINX-UPGRADE 8 "2012-10-28" " " " " +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.if n .ad l +.nh +.SH "NAME" +nginx\-upgrade \- tool to upgrade nginx without any downtime +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +\&\fInginx-upgrade\fR +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +This downstream shell script updates nginx without any downtime. After +upgrading nginx via the package manager, running this script will create +a new nginx master. This master takes over all new requests. The old +masters and workers are then gracefully shutdown without breaking any +existing connections. +.PP +For further information, see: +.SH "BUGS" +.IX Header "BUGS" +If you find any bugs, please send an email to the author. +.SH "AUTHOR" +.IX Header "AUTHOR" +Jamie Nguyen diff --git a/SOURCES/nginx.conf b/SOURCES/nginx.conf new file mode 100755 index 0000000..ae56014 --- /dev/null +++ b/SOURCES/nginx.conf @@ -0,0 +1,7 @@ +LoadPlugin nginx +# +# URL "http://localhost/status?auto" +# User "www-user" +# Password "secret" +# CACert "/etc/ssl/ca.crt" +# diff --git a/SOURCES/nginx.init b/SOURCES/nginx.init new file mode 100755 index 0000000..094fc65 --- /dev/null +++ b/SOURCES/nginx.init @@ -0,0 +1,144 @@ +#!/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/SOURCES/nginx.service b/SOURCES/nginx.service new file mode 100755 index 0000000..0a2aac2 --- /dev/null +++ b/SOURCES/nginx.service @@ -0,0 +1,15 @@ +[Unit] +Description=The nginx HTTP and reverse proxy server +After=syslog.target network.target remote-fs.target nss-lookup.target + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t +ExecStart=/usr/sbin/nginx +ExecReload=/bin/kill -s HUP $MAINPID +ExecStop=/bin/kill -s QUIT $MAINPID +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/SOURCES/nginx.sysconfig b/SOURCES/nginx.sysconfig new file mode 100755 index 0000000..8ba359b --- /dev/null +++ b/SOURCES/nginx.sysconfig @@ -0,0 +1,4 @@ +# 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/SPECS/nginx.spec b/SPECS/nginx.spec new file mode 100755 index 0000000..f7c01ac --- /dev/null +++ b/SPECS/nginx.spec @@ -0,0 +1,214 @@ +%global _hardened_build 1 +%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 + +Name: nginx +Version: 1.13.9 +Release: 1%{?dist} +Epoch: 1 +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.org/ +Source0: http://nginx.org/download/nginx-%{version}.tar.gz +Source1: http://nginx.org/download/nginx-%{version}.tar.gz.asc +Source10: nginx.service +Source11: nginx.logrotate +Source12: nginx.conf +Source13: nginx-upgrade +Source14: nginx-upgrade.8 +Source15: nginx.init +Source16: nginx.sysconfig +Source100: index.html +Source101: poweredby.png +Source102: nginx-logo.png +Source103: 404.html +Source104: 50x.html +# addons to be compiled with nginx +Source201: Nginx-accesskey-2.0.3.tar.gz +Source202: nginx-http-auth-digest-4edfb18.tar.xz +Source203: ngx_slowfs_cache-1.10.tar.gz +Source204: nginx-http-user-agent-785e76d.tar.xz +# 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 +BuildRequires: GeoIP-devel +BuildRequires: gd-devel +BuildRequires: gperftools-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: perl +Requires(pre): shadow-utils +Provides: webserver +BuildRequires: systemd +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + + +%description +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 -a 201 -a 202 -a 203 -a 204 +%patch0 -p0 + + +%build +export DESTDIR=%{buildroot} +./configure \ + --prefix=%{nginx_datadir} \ + --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 \ + --http-proxy-temp-path=%{nginx_home_tmp}/proxy \ + --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=/run/nginx.pid \ + --lock-path=/run/lock/subsys/nginx \ + --user=%{nginx_user} \ + --group=%{nginx_group} \ + --with-ipv6 \ + --with-threads \ + --with-file-aio \ + --with-http_ssl_module \ + --with-http_v2_module \ + --with-http_realip_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_geoip_module \ + --with-http_addition_module \ + --with-http_xslt_module \ + --with-http_image_filter_module \ + --with-http_sub_module \ + --with-http_dav_module \ + --with-http_flv_module \ + --with-http_mp4_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-mail \ + --with-mail_ssl_module \ + --with-pcre-jit \ + --with-google_perftools_module \ + --with-stream \ + --with-stream_realip_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --add-module=nginx-http-auth-digest-4edfb18 \ + --add-module=ngx_slowfs_cache-1.10 \ + --add-module=nginx-http-user-agent-785e76d \ + --with-debug \ + --with-cc-opt="%{optflags} $(pcre-config --cflags)" \ + --with-ld-opt="$RPM_LD_FLAGS -Wl,-E" +make %{?_smp_mflags} + + #--add-module=nginx-accesskey-2.0.3 \ + + +%install +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 -iname '*.so' -exec chmod 0755 '{}' \; +install -p -D -m 0644 %{SOURCE10} %{buildroot}%{_unitdir}/nginx.service +install -p -D -m 0644 %{SOURCE16} %{buildroot}%{_sysconfdir}/sysconfig/nginx +install -p -D -m 0644 %{SOURCE11} %{buildroot}%{_sysconfdir}/logrotate.d/nginx +install -p -d -m 0755 %{buildroot}%{nginx_confdir}/conf.d +install -p -d -m 0700 %{buildroot}%{nginx_home} +install -p -d -m 0700 %{buildroot}%{nginx_home_tmp} +install -p -d -m 0700 %{buildroot}%{nginx_logdir} +install -p -d -m 0755 %{buildroot}%{nginx_webroot} +install -p -m 0644 %{SOURCE12} %{buildroot}%{nginx_confdir} +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} +install -p -D -m 0644 %{_builddir}/nginx-%{version}/man/nginx.8 %{buildroot}%{_mandir}/man8/nginx.8 +install -p -D -m 0755 %{SOURCE13} %{buildroot}%{_bindir}/nginx-upgrade +install -p -D -m 0644 %{SOURCE14} %{buildroot}%{_mandir}/man8/nginx-upgrade.8 + + +%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 +%systemd_post nginx.service + + +%preun +%systemd_preun nginx.service + + +%postun +%systemd_postun nginx.service + + +%files +%doc LICENSE CHANGES README +%{nginx_datadir}/ +%{_bindir}/nginx-upgrade +%{_sbindir}/nginx +%{_sbindir}/nginx.old +%{_mandir}/man3/nginx.3pm* +%{_mandir}/man8/nginx.8* +%{_mandir}/man8/nginx-upgrade.8* +%{_unitdir}/nginx.service +%config(noreplace) %{_sysconfdir}/sysconfig/nginx +%dir %{nginx_confdir} +%dir %{nginx_confdir}/conf.d +%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}/win-utf +%config(noreplace) %{_sysconfdir}/logrotate.d/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(700,%{nginx_user},%{nginx_group}) %dir %{nginx_home_tmp} +%attr(700,%{nginx_user},%{nginx_group}) %dir %{nginx_logdir} + + +%changelog