Skip to contentSkip to conversation

nginx: new package

PATCH Superseded Samuel Martin 2 participants 2 messages Aug 4, 2014 – Sep 2, 2014

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 nginx: new package

nginx module selection is, by default, the same as the one sets by the upstream configure script.

Patches improving the cross-compilation support have already been sent upstream for integration [1-5].

All these patches are needed because nginx uses its own handwritten build-system, which is cross-platform, but does not properly support cross-compilation.

Fixes bug: #3427 [6]

[1] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005722.html
[2] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005724.html
[3] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005725.html
[4] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005723.html
[5] http://mailman.nginx.org/pipermail/nginx-devel/2014-August/005726.html
[6] https://bugs.uclibc.org/show_bug.cgi?id=3427

Cc Daniele Salvatore Albano <[email protected]>
Cc Maxime Hadjinlian <[email protected]>
Cc Johan Oudinet <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Gustavo Zacarias <[email protected]>

---
changes v2 -> v3:
- rollback to stable release (1.6.0) instead of latest one (Gustavo)
- add comments in nginx.mk
- extend commit log

changes v1 -> v2:
- add SSL module knobs (ThomasP)
- turn all BR2_PACKAGE_* symbols fully uppercase (ThomasP)
- add pid file option to start-stop-daemon (ThomasP)
- do not pass default "-I..." "-L..." locations (ThomasP)
- fix --prefix (ThomasP)
- fix missing brackets

---
 package/Config.in                                  |   1 +
 package/nginx/Config.in                            | 324 +++++++++++++++++++++
 package/nginx/S50nginx                             |  26 ++
 ...izeof-rework-autotest-to-be-cross-compila.patch |  88 ++++++
 ...e-add-mechanism-allowing-to-force-feature.patch | 135 +++++++++
 ...x_feature_run_force_result-for-each-featu.patch | 209 +++++++++++++
 ...bxslt-conf-allow-to-override-ngx_feature_.patch |  42 +++
 ...nix-make-sys_nerr-guessing-cross-friendly.patch | 133 +++++++++
 package/nginx/nginx.logrotate                      |   9 +
 package/nginx/nginx.mk                             | 235 +++++++++++++++
 package/nginx/nginx.service                        |  15 +
 11 files changed, 1217 insertions(+)
 create mode 100644 package/nginx/Config.in
 create mode 100755 package/nginx/S50nginx
 create mode 100644 package/nginx/nginx-0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch
 create mode 100644 package/nginx/nginx-0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
 create mode 100644 package/nginx/nginx-0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch
 create mode 100644 package/nginx/nginx-0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch
 create mode 100644 package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch
 create mode 100644 package/nginx/nginx.logrotate
 create mode 100644 package/nginx/nginx.mk
 create mode 100644 package/nginx/nginx.service
package/Config.in +1 -0
index 2f92c19..c334463 100644
@@ -1024,6 +1024,7 @@ endif
 	source "package/network-manager/Config.in"
 	source "package/nfacct/Config.in"
 	source "package/nftables/Config.in"
+	source "package/nginx/Config.in"
 	source "package/ngircd/Config.in"
 	source "package/ngrep/Config.in"
 	source "package/nmap/Config.in"
package/nginx/Config.in new file +324 -0

324 lines not on this page · raw message

package/nginx/S50nginx new file +26 -0
new file mode 100755
index 0000000..8464236
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Start/stop nginx
+#
+
+PIDFILE=/var/run/nginx.pid
+
+case "$1" in
+  start)
+	echo "Starting nginx..."
+	start-stop-daemon -S -x -p $PIDFILE nginx
+	;;
+  stop)
+	echo -n "Stopping nginx..."
+	start-stop-daemon -K -o -p $PIDFILE
+	;;
+  restart|reload)
+	"$0" stop
+	"$0" start
+	;;
+  *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
package/nginx/nginx-0001-auto-type-sizeof-rework-autotest-to-be-cross-compila.patch new file +88 -0

88 lines not on this page · raw message

package/nginx/nginx-0002-auto-feature-add-mechanism-allowing-to-force-feature.patch new file +135 -0

135 lines not on this page · raw message

package/nginx/nginx-0003-auto-set-ngx_feature_run_force_result-for-each-featu.patch new file +209 -0

209 lines not on this page · raw message

package/nginx/nginx-0004-auto-lib-libxslt-conf-allow-to-override-ngx_feature_.patch new file +42 -0

42 lines not on this page · raw message

package/nginx/nginx-0005-auto-unix-make-sys_nerr-guessing-cross-friendly.patch new file +133 -0

133 lines not on this page · raw message

package/nginx/nginx.logrotate new file +9 -0
new file mode 100644
index 0000000..e0fa9ec
@@ -0,0 +1,9 @@
+/var/log/nginx/*log {
+	missingok
+	create 640 http log
+	sharedscripts
+	compress
+	postrotate
+		test ! -r /var/run/nginx.pid || kill -USR1 `cat /var/run/nginx.pid`
+	endscript
+}
package/nginx/nginx.mk new file +235 -0

235 lines not on this page · raw message

package/nginx/nginx.service new file +15 -0
new file mode 100644
index 0000000..6f420a7
@@ -0,0 +1,15 @@
+[Unit]
+Description=A high performance web server and a reverse proxy server
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/nginx.pid
+ExecStartPre=/usr/bin/nginx -t -q -g 'pid /var/run/nginx.pid; daemon on; master_process on;'
+ExecStart=/usr/bin/nginx -g 'pid /var/run/nginx.pid; daemon on; master_process on;'
+ExecReload=/usr/bin/nginx -g 'pid /var/run/nginx.pid; daemon on; master_process on;' -s reload
+ExecStop=/usr/bin/nginx -g 'pid /var/run/nginx.pid;' -s quit
+PrivateDevices=yes
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.0.3
#1 lore raw

PATCH v3 1/1 nginx: new package

Hi Samuel, All,

I made few changes to your patch to make in work on my Raspberry PI. See inline comments below.

package/nginx/S50nginx line 11

Quoted 13 lines · Samuel Martin

+++ b/package/nginx/S50nginx

package/nginx/S50nginx new file +11 -0
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Start/stop nginx
+#
+
+PIDFILE=/var/run/nginx.pid
+
+case "$1" in
+  start)
+       echo "Starting nginx..."
+       start-stop-daemon -S -x -p $PIDFILE nginx

The -p option does not work in this position:

$ /etc/init.d/S50nginx start
Starting nginx...
start-stop-daemon: can't execute '-p': No such file or directory

According to start-stop-daemon manual:
-p, --pidfile pid-file
Check whether a process has created the file pid-file. Note:
using this matching option alone might cause unintended pro? cesses to be acted on, if the old process terminated without being able to remove the pid-file.

-x, --exec executable
Check for processes that are instances of this executable. The executable argument should be an absolute pathname. Note: this might not work as intended with interpreted scripts, as the exe? cutable will point to the interpreter. Take into account pro? cesses running from inside a chroot will also be matched, so other match restrictions might be needed.

Thus, the following command works:
start-stop-daemon -S -x /usr/sbin/nginx -p $PIDFILE

package/nginx/S50nginx line 26

Quoted 3 lines
package/nginx/S50nginx new file +3 -0
+esac
+
+exit $?

People from this mailing list told me to remove this last line as it is already the default behavior of a script to return the last command result.

package/nginx/nginx.mk line 7

Quoted 1 line
package/nginx/nginx.mk new file +1 -0
+NGINX_VERSION = 1.6.0

1.6.1 has been released since you've submitted this patch. You might consider to updated it if you submit a new version.

package/nginx/nginx.mk line 49

Quoted 3 lines
package/nginx/nginx.mk new file +3 -0
+
+NGINX_CONF_OPT += \
+       --prefix=/usr \

You should use /usr/nginx. Otherwise, it will create an html folder in /usr.

package/nginx/nginx.mk line 51

Quoted 2 lines
package/nginx/nginx.mk new file +2 -0
+       --conf-path=/etc/nginx/nginx.conf \
+       --sbin-path=/usr/bin/nginx \

it should be /usr/sbin/nginx

package/nginx/nginx.mk line 52

Quoted 1 line
package/nginx/nginx.mk new file +1 -0
+       --pid-path=/var/run/nginx.pid \

I think we should prefer /run instead of /var/run. The later is now deprecated and is usually a symbolic link to /run

package/nginx/nginx.mk line 56

Quoted 4 lines
package/nginx/nginx.mk new file +4 -0
+       --lock-path=/var/lock/nginx.lock \
+       --user=www-data \
+       --group=www-data \
+       --error-log-path=stderr \

It's annoying to have every nginx error printed on stderr. Use /var/log/nginx/error.log instead.

package/nginx/nginx.mk line 62

Quoted 5 lines
package/nginx/nginx.mk new file +5 -0
+       --http-client-body-temp-path=/var/lib/nginx/client-body \
+       --http-proxy-temp-path=/var/lib/nginx/proxy \
+       --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
+       --http-scgi-temp-path=/var/lib/nginx/scgi \
+       --http-uwsgi-temp-path=/var/lib/nginx/uwsgi

I think /var/tmp should be used instead of /var/lib for these temporary folders.

Thanks again for your work. That's great to have nginx on buildroot ;-)

Signature · 1 line
Johan