summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch217
-rw-r--r--meta-webserver/recipes-httpd/nginx/files/nginx-volatile.conf2
-rw-r--r--meta-webserver/recipes-httpd/nginx/files/nginx.conf118
-rwxr-xr-xmeta-webserver/recipes-httpd/nginx/files/nginx.init52
-rw-r--r--meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb117
5 files changed, 506 insertions, 0 deletions
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch b/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch
new file mode 100644
index 000000000..5f899a1d8
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch
@@ -0,0 +1,217 @@
1We do not have capability to run binaries when cross compiling
2
3Upstream-Status: Pending
4
5
6diff -uraN nginx-1.0.11.orig/auto/feature nginx-1.0.11/auto/feature
7--- nginx-1.0.11.orig/auto/feature 2011-05-11 06:50:19.000000000 -0500
8+++ nginx-1.0.11/auto/feature 2011-12-27 13:56:42.323370040 -0600
9@@ -48,12 +48,20 @@
10
11 if [ -x $NGX_AUTOTEST ]; then
12
13+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
14+ NGX_AUTOTEST_EXEC="true"
15+ NGX_FOUND_MSG=" (not tested, cross compiling)"
16+ else
17+ NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
18+ NGX_FOUND_MSG=""
19+ fi
20+
21 case "$ngx_feature_run" in
22
23 yes)
24 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
25- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
26- echo " found"
27+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
28+ echo " found$NGX_FOUND_MSG"
29 ngx_found=yes
30
31 if test -n "$ngx_feature_name"; then
32@@ -67,17 +75,27 @@
33
34 value)
35 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
36- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
37- echo " found"
38+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
39+ echo " found$NGX_FOUND_MSG"
40 ngx_found=yes
41
42- cat << END >> $NGX_AUTO_CONFIG_H
43+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
44+ cat << END >> $NGX_AUTO_CONFIG_H
45
46 #ifndef $ngx_feature_name
47-#define $ngx_feature_name `$NGX_AUTOTEST`
48+#define $ngx_feature_name $(eval "echo \$NGX_WITH_${ngx_feature_name}")
49 #endif
50
51 END
52+ else
53+ cat << END >> $NGX_AUTO_CONFIG_H
54+
55+#ifndef $ngx_feature_name
56+#define $ngx_feature_name `$NGX_AUTOTEST_EXEC`
57+#endif
58+
59+END
60+ fi
61 else
62 echo " found but is not working"
63 fi
64@@ -85,7 +103,7 @@
65
66 bug)
67 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
68- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
69+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
70 echo " not found"
71
72 else
73diff -uraN nginx-1.0.11.orig/auto/options nginx-1.0.11/auto/options
74--- nginx-1.0.11.orig/auto/options 2011-12-14 07:34:16.000000000 -0600
75+++ nginx-1.0.11/auto/options 2011-12-27 13:56:42.323370040 -0600
76@@ -289,6 +289,18 @@
77 --test-build-rtsig) NGX_TEST_BUILD_RTSIG=YES ;;
78 --test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
79
80+ # cross compile support
81+ --with-int=*) NGX_WITH_INT="$value" ;;
82+ --with-long=*) NGX_WITH_LONG="$value" ;;
83+ --with-long-long=*) NGX_WITH_LONG_LONG="$value" ;;
84+ --with-ptr-size=*) NGX_WITH_PTR_SIZE="$value" ;;
85+ --with-sig-atomic-t=*) NGX_WITH_SIG_ATOMIC_T="$value" ;;
86+ --with-size-t=*) NGX_WITH_SIZE_T="$value" ;;
87+ --with-off-t=*) NGX_WITH_OFF_T="$value" ;;
88+ --with-time-t=*) NGX_WITH_TIME_T="$value" ;;
89+ --with-sys-nerr=*) NGX_WITH_NGX_SYS_NERR="$value" ;;
90+ --with-endian=*) NGX_WITH_ENDIAN="$value" ;;
91+
92 *)
93 echo "$0: error: invalid option \"$option\""
94 exit 1
95@@ -434,6 +446,17 @@
96
97 --with-debug enable debug logging
98
99+ --with-int=VALUE force int size
100+ --with-long=VALUE force long size
101+ --with-long-long=VALUE force long long size
102+ --with-ptr-size=VALUE force pointer size
103+ --with-sig-atomic-t=VALUE force sig_atomic_t size
104+ --with-size-t=VALUE force size_t size
105+ --with-off-t=VALUE force off_t size
106+ --with-time-t=VALUE force time_t size
107+ --with-sys-nerr=VALUE force sys_nerr value
108+ --with-endian=VALUE force system endianess
109+
110 END
111
112 exit 1
113@@ -455,6 +478,8 @@
114
115 if [ ".$NGX_PLATFORM" = ".win32" ]; then
116 NGX_WINE=$WINE
117+elif [ ! -z "$NGX_PLATFORM" ]; then
118+ NGX_CROSS_COMPILE="yes"
119 fi
120
121
122diff -uraN nginx-1.0.11.orig/auto/types/sizeof nginx-1.0.11/auto/types/sizeof
123--- nginx-1.0.11.orig/auto/types/sizeof 2006-06-28 11:00:26.000000000 -0500
124+++ nginx-1.0.11/auto/types/sizeof 2011-12-27 13:56:42.323370040 -0600
125@@ -11,9 +11,12 @@
126
127 END
128
129-ngx_size=
130+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
131
132-cat << END > $NGX_AUTOTEST.c
133+if [ ".$ngx_size" != "." ]; then
134+ echo " $ngx_size bytes"
135+else
136+ cat << END > $NGX_AUTOTEST.c
137
138 #include <sys/types.h>
139 #include <sys/time.h>
140@@ -31,19 +34,20 @@
141 END
142
143
144-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
145- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
146+ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
147+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
148
149-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
150+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
151
152
153-if [ -x $NGX_AUTOTEST ]; then
154- ngx_size=`$NGX_AUTOTEST`
155- echo " $ngx_size bytes"
156-fi
157+ if [ -x $NGX_AUTOTEST ]; then
158+ ngx_size=`$NGX_AUTOTEST`
159+ echo " $ngx_size bytes"
160+ fi
161
162
163-rm -f $NGX_AUTOTEST
164+ rm -f $NGX_AUTOTEST
165+fi
166
167
168 case $ngx_size in
169diff -uraN nginx-1.0.11.orig/auto/unix nginx-1.0.11/auto/unix
170--- nginx-1.0.11.orig/auto/unix 2011-12-14 07:34:16.000000000 -0600
171+++ nginx-1.0.11/auto/unix 2011-12-27 13:56:42.327370060 -0600
172@@ -393,13 +393,13 @@
173
174 # C types
175
176-ngx_type="int"; . auto/types/sizeof
177+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
178
179-ngx_type="long"; . auto/types/sizeof
180+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
181
182-ngx_type="long long"; . auto/types/sizeof
183+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
184
185-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
186+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
187 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
188
189
190@@ -416,7 +416,7 @@
191
192 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
193
194-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
195+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
196 . auto/types/sizeof
197 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
198
199@@ -432,15 +432,15 @@
200
201 . auto/endianess
202
203-ngx_type="size_t"; . auto/types/sizeof
204+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
205 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
206 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
207
208-ngx_type="off_t"; . auto/types/sizeof
209+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
210 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
211 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
212
213-ngx_type="time_t"; . auto/types/sizeof
214+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
215 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
216 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
217
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx-volatile.conf b/meta-webserver/recipes-httpd/nginx/files/nginx-volatile.conf
new file mode 100644
index 000000000..93f3c6634
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx-volatile.conf
@@ -0,0 +1,2 @@
1d www www-data 0755 /run/nginx none
2d root root 0755 /var/log/nginx none
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.conf b/meta-webserver/recipes-httpd/nginx/files/nginx.conf
new file mode 100644
index 000000000..fb7e4b65d
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.conf
@@ -0,0 +1,118 @@
1
2user www-data;
3worker_processes 1;
4
5error_log /var/log/nginx/error.log;
6#error_log logs/error.log notice;
7#error_log logs/error.log info;
8
9pid /run/nginx/nginx.pid;
10
11
12events {
13 worker_connections 1024;
14}
15
16
17http {
18 include mime.types;
19 default_type application/octet-stream;
20
21 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
22 '$status $body_bytes_sent "$http_referer" '
23 '"$http_user_agent" "$http_x_forwarded_for"';
24
25 access_log /var/log/nginx/access.log main;
26
27 sendfile on;
28 #tcp_nopush on;
29
30 #keepalive_timeout 0;
31 keepalive_timeout 65;
32
33 #gzip on;
34
35 server {
36 listen 80;
37 server_name localhost;
38
39 #charset koi8-r;
40
41 #access_log logs/host.access.log main;
42
43 location / {
44 root /var/www/localhost/html;
45 index index.html index.htm;
46 }
47
48 #error_page 404 /404.html;
49
50 # redirect server error pages to the static page /50x.html
51 #
52 error_page 500 502 503 504 /50x.html;
53 location = /50x.html {
54 root /var/www/localhost/html;
55 }
56
57 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
58 #
59 #location ~ \.php$ {
60 # proxy_pass http://127.0.0.1;
61 #}
62
63 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
64 #
65 #location ~ \.php$ {
66 # root html;
67 # fastcgi_pass 127.0.0.1:9000;
68 # fastcgi_index index.php;
69 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
70 # include fastcgi_params;
71 #}
72
73 # deny access to .htaccess files, if Apache's document root
74 # concurs with nginx's one
75 #
76 #location ~ /\.ht {
77 # deny all;
78 #}
79 }
80
81
82 # another virtual host using mix of IP-, name-, and port-based configuration
83 #
84 #server {
85 # listen 8000;
86 # listen somename:8080;
87 # server_name somename alias another.alias;
88
89 # location / {
90 # root html;
91 # index index.html index.htm;
92 # }
93 #}
94
95
96 # HTTPS server
97 #
98 #server {
99 # listen 443;
100 # server_name localhost;
101
102 # ssl on;
103 # ssl_certificate cert.pem;
104 # ssl_certificate_key cert.key;
105
106 # ssl_session_timeout 5m;
107
108 # ssl_protocols SSLv2 SSLv3 TLSv1;
109 # ssl_ciphers HIGH:!aNULL:!MD5;
110 # ssl_prefer_server_ciphers on;
111
112 # location / {
113 # root html;
114 # index index.html index.htm;
115 # }
116 #}
117
118}
diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.init b/meta-webserver/recipes-httpd/nginx/files/nginx.init
new file mode 100755
index 000000000..0f38b9cdb
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/files/nginx.init
@@ -0,0 +1,52 @@
1#! /bin/sh
2PATH=/sbin:/bin:/usr/sbin:/usr/bin
3DAEMON=/usr/sbin/nginx
4NAME=nginx
5DESC=nginx
6PID=/var/run/nginx/nginx.pid
7
8test -x $DAEMON || exit 0
9
10# Include nginx defaults if available
11if [ -f /etc/default/nginx ] ; then
12 . /etc/default/nginx
13fi
14
15set -e
16
17case "$1" in
18 start)
19 echo -n "Starting $DESC: "
20 start-stop-daemon --start --quiet --pidfile $PID \
21 --name $NAME --exec $DAEMON -- $DAEMON_OPTS
22 echo "$NAME."
23 ;;
24 stop)
25 echo -n "Stopping $DESC: "
26 start-stop-daemon -K --quiet --pidfile $PID \
27 --name $NAME
28 echo "$NAME."
29 ;;
30 restart|force-reload)
31 echo -n "Restarting $DESC: "
32 start-stop-daemon -K --quiet --pidfile $PID \
33 --name $NAME
34 sleep 1
35 start-stop-daemon --start --quiet --pidfile $PID \
36 --name $NAME --exec $DAEMON -- $DAEMON_OPTS
37 echo "$NAME."
38 ;;
39 reload)
40 echo -n "Reloading $DESC configuration: "
41 start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \
42 --exec $DAEMON
43 echo "$NAME."
44 ;;
45 *)
46 N=/etc/init.d/$NAME
47 echo "Usage: $N {start|stop|restart|force-reload}" >&2
48 exit 1
49 ;;
50esac
51
52exit 0
diff --git a/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb b/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb
new file mode 100644
index 000000000..e78ed34dd
--- /dev/null
+++ b/meta-webserver/recipes-httpd/nginx/nginx_1.4.4.bb
@@ -0,0 +1,117 @@
1SUMMARY = "HTTP and reverse proxy server"
2
3DESCRIPTION = "Nginx is a web server and a reverse proxy server for \
4HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high \
5concurrency, performance and low memory usage."
6
7HOMEPAGE = "http://nginx.org/"
8LICENSE = "BSD-2-Clause"
9LIC_FILES_CHKSUM = "file://LICENSE;md5=917bfdf005ffb6fd025550414ff05a9f"
10SECTION = "net"
11
12DEPENDS = "libpcre gzip openssl"
13
14SRC_URI = " \
15 http://nginx.org/download/nginx-${PV}.tar.gz \
16 file://nginx-cross.patch \
17 file://nginx.conf \
18 file://nginx.init \
19 file://nginx-volatile.conf \
20"
21SRC_URI[md5sum] = "5dfaba1cbeae9087f3949860a02caa9f"
22SRC_URI[sha256sum] = "7c989a58e5408c9593da0bebcd0e4ffc3d892d1316ba5042ddb0be5b0b4102b9"
23
24inherit update-rc.d useradd
25
26do_configure () {
27 if [ "${SITEINFO_BITS}" = "64" ]; then
28 PTRSIZE=8
29 else
30 PTRSIZE=4
31 fi
32
33 echo $CFLAGS
34 echo $LDFLAGS
35
36 ./configure \
37 --crossbuild=Linux:${TUNE_ARCH} \
38 --with-endian=${@base_conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \
39 --with-int=4 \
40 --with-long=${PTRSIZE} \
41 --with-long-long=8 \
42 --with-ptr-size=${PTRSIZE} \
43 --with-sig-atomic-t=${PTRSIZE} \
44 --with-size-t=${PTRSIZE} \
45 --with-off-t=${PTRSIZE} \
46 --with-time-t=${PTRSIZE} \
47 --with-sys-nerr=132 \
48 --conf-path=${sysconfdir}/nginx/nginx.conf \
49 --http-log-path=${localstatedir}/log/nginx/access.log \
50 --error-log-path=${localstatedir}/log/nginx/error.log \
51 --pid-path=/run/nginx/nginx.pid \
52 --prefix=${prefix} \
53 --with-http_ssl_module \
54 --with-http_gzip_static_module
55}
56
57do_install () {
58 oe_runmake 'DESTDIR=${D}' install
59 rm -fr ${D}${localstatedir}/run ${D}/run
60 if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
61 install -d ${D}${sysconfdir}/tmpfiles.d
62 echo "d /run/${BPN} - - - -" \
63 > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf
64 fi
65 install -d ${D}${sysconfdir}/${BPN}
66 ln -snf ${localstatedir}/run/${BPN} ${D}${sysconfdir}/${BPN}/run
67 install -d ${D}${localstatedir}/www/localhost
68 mv ${D}/usr/html ${D}${localstatedir}/www/localhost/
69 chown www:www-data -R ${D}${localstatedir}
70
71 install -d ${D}${sysconfdir}/init.d
72 install -m 0755 ${WORKDIR}/nginx.init ${D}${sysconfdir}/init.d/nginx
73 sed -i 's,/usr/sbin/,${sbindir}/,g' ${D}${sysconfdir}/init.d/nginx
74 sed -i 's,/etc/,${sysconfdir}/,g' ${D}${sysconfdir}/init.d/nginx
75
76 install -d ${D}${sysconfdir}/nginx
77 install -m 0644 ${WORKDIR}/nginx.conf ${D}${sysconfdir}/nginx/nginx.conf
78 sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/nginx/nginx.conf
79 install -d ${D}${sysconfdir}/nginx/sites-enabled
80
81 install -d ${D}${sysconfdir}/default/volatiles
82 install -m 0644 ${WORKDIR}/nginx-volatile.conf ${D}${sysconfdir}/default/volatiles/99_nginx
83 sed -i 's,/var/,${localstatedir}/,g' ${D}${sysconfdir}/default/volatiles/99_nginx
84}
85
86pkg_postinst_${PN} () {
87 if [ -z "$D" ]; then
88 if type systemd-tmpfiles >/dev/null; then
89 systemd-tmpfiles --create
90 elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
91 ${sysconfdir}/init.d/populate-volatile.sh update
92 fi
93 fi
94}
95
96FILES_${PN} += "${localstatedir}/"
97
98CONFFILES_${PN} = "${sysconfdir}/nginx/nginx.conf \
99 ${sysconfdir}/nginx/fastcgi.conf\
100 ${sysconfdir}/nginx/fastcgi_params \
101 ${sysconfdir}/nginx/koi-utf \
102 ${sysconfdir}/nginx/koi-win \
103 ${sysconfdir}/nginx/mime.types \
104 ${sysconfdir}/nginx/scgi_params \
105 ${sysconfdir}/nginx/uwsgi_params \
106 ${sysconfdir}/nginx/win-utf \
107"
108
109INITSCRIPT_NAME = "nginx"
110INITSCRIPT_PARAMS = "defaults 92 20"
111
112USERADD_PACKAGES = "${PN}"
113USERADD_PARAM_${PN} = " \
114 --system --no-create-home \
115 --home ${localstatedir}/www/localhost \
116 --groups www-data \
117 --user-group www"