added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,80 @@
From be9970aa16c5142ef814531d74a07990a8e9eb14 Mon Sep 17 00:00:00 2001
From: Derek Straka <derek@asterius.io>
Date: Fri, 1 Dec 2017 10:32:29 -0500
Subject: [PATCH] Allow the overriding of the endianness via the configure flag
--with-endian
The existing configure options contain the --with-endian; however, the command
line flag does not actually function. It does not set the endianness and it
appears to do nothing.
Upstream-Status: Pending
Signed-off-by: Derek Straka <derek@asterius.io>
diff --git a/auto/endianness b/auto/endianness
index 1b552b6..be84487 100644
--- a/auto/endianness
+++ b/auto/endianness
@@ -13,7 +13,13 @@ checking for system byte ordering
END
-cat << END > $NGX_AUTOTEST.c
+if [ ".$NGX_WITH_ENDIAN" = ".little" ]; then
+ echo " little endian"
+ have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+elif [ ".$NGX_WITH_ENDIAN" = ".big" ]; then
+ echo " big endian"
+else
+ cat << END > $NGX_AUTOTEST.c
int main(void) {
int i = 0x11223344;
@@ -26,25 +32,26 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
-if [ -x $NGX_AUTOTEST ]; then
- if $NGX_AUTOTEST >/dev/null 2>&1; then
- echo " little endian"
- have=NGX_HAVE_LITTLE_ENDIAN . auto/have
- else
- echo " big endian"
- fi
+ if [ -x $NGX_AUTOTEST ]; then
+ if $NGX_AUTOTEST >/dev/null 2>&1; then
+ echo " little endian"
+ have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+ else
+ echo " big endian"
+ fi
- rm -rf $NGX_AUTOTEST*
+ rm -rf $NGX_AUTOTEST*
-else
- rm -rf $NGX_AUTOTEST*
+ else
+ rm -rf $NGX_AUTOTEST*
- echo
- echo "$0: error: cannot detect system byte ordering"
- exit 1
+ echo
+ echo "$0: error: cannot detect system byte ordering"
+ exit 1
+ fi
fi
--
2.7.4

View File

@@ -0,0 +1,14 @@
# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/localhost/html;
index index.html index.htm;
server_name _;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
}

View File

@@ -0,0 +1,215 @@
We do not have capability to run binaries when cross compiling
Upstream-Status: Pending
Index: nginx-1.12.2/auto/feature
===================================================================
--- nginx-1.12.2.orig/auto/feature
+++ nginx-1.12.2/auto/feature
@@ -49,12 +49,20 @@ eval "/bin/sh -c \"$ngx_test\" >> $NGX_A
if [ -x $NGX_AUTOTEST ]; then
+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+ NGX_AUTOTEST_EXEC="true"
+ NGX_FOUND_MSG=" (not tested, cross compiling)"
+ else
+ NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
+ NGX_FOUND_MSG=""
+ fi
+
case "$ngx_feature_run" in
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
- echo " found"
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+ echo " found$NGX_FOUND_MSG"
ngx_found=yes
if test -n "$ngx_feature_name"; then
@@ -68,17 +76,27 @@ if [ -x $NGX_AUTOTEST ]; then
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
- echo " found"
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+ echo " found$NGX_FOUND_MSG"
ngx_found=yes
- cat << END >> $NGX_AUTO_CONFIG_H
+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+ cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
-#define $ngx_feature_name `$NGX_AUTOTEST`
+#define $ngx_feature_name $(eval "echo \$NGX_WITH_${ngx_feature_name}")
#endif
END
+ else
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name `$NGX_AUTOTEST_EXEC`
+#endif
+
+END
+ fi
else
echo " found but is not working"
fi
@@ -86,7 +104,7 @@ END
bug)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
echo " not found"
else
Index: nginx-1.12.2/auto/options
===================================================================
--- nginx-1.12.2.orig/auto/options
+++ nginx-1.12.2/auto/options
@@ -386,6 +386,18 @@ $0: warning: the \"--with-sha1-asm\" opt
--test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;;
--test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
+ # cross compile support
+ --with-int=*) NGX_WITH_INT="$value" ;;
+ --with-long=*) NGX_WITH_LONG="$value" ;;
+ --with-long-long=*) NGX_WITH_LONG_LONG="$value" ;;
+ --with-ptr-size=*) NGX_WITH_PTR_SIZE="$value" ;;
+ --with-sig-atomic-t=*) NGX_WITH_SIG_ATOMIC_T="$value" ;;
+ --with-size-t=*) NGX_WITH_SIZE_T="$value" ;;
+ --with-off-t=*) NGX_WITH_OFF_T="$value" ;;
+ --with-time-t=*) NGX_WITH_TIME_T="$value" ;;
+ --with-sys-nerr=*) NGX_WITH_NGX_SYS_NERR="$value" ;;
+ --with-endian=*) NGX_WITH_ENDIAN="$value" ;;
+
*)
echo "$0: error: invalid option \"$option\""
exit 1
@@ -568,6 +580,17 @@ cat << END
--with-debug enable debug logging
+ --with-int=VALUE force int size
+ --with-long=VALUE force long size
+ --with-long-long=VALUE force long long size
+ --with-ptr-size=VALUE force pointer size
+ --with-sig-atomic-t=VALUE force sig_atomic_t size
+ --with-size-t=VALUE force size_t size
+ --with-off-t=VALUE force off_t size
+ --with-time-t=VALUE force time_t size
+ --with-sys-nerr=VALUE force sys_nerr value
+ --with-endian=VALUE force system endianess
+
END
exit 1
@@ -576,6 +599,8 @@ fi
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
+elif [ ! -z "$NGX_PLATFORM" ]; then
+ NGX_CROSS_COMPILE="yes"
fi
Index: nginx-1.12.2/auto/types/sizeof
===================================================================
--- nginx-1.12.2.orig/auto/types/sizeof
+++ nginx-1.12.2/auto/types/sizeof
@@ -12,9 +12,12 @@ checking for $ngx_type size
END
-ngx_size=
+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
-cat << END > $NGX_AUTOTEST.c
+if [ ".$ngx_size" != "." ]; then
+ echo " $ngx_size bytes"
+else
+ cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
#include <sys/time.h>
@@ -33,15 +36,16 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
-if [ -x $NGX_AUTOTEST ]; then
- ngx_size=`$NGX_AUTOTEST`
- echo " $ngx_size bytes"
+ if [ -x $NGX_AUTOTEST ]; then
+ ngx_size=`$NGX_AUTOTEST`
+ echo " $ngx_size bytes"
+ fi
fi
Index: nginx-1.12.2/auto/unix
===================================================================
--- nginx-1.12.2.orig/auto/unix
+++ nginx-1.12.2/auto/unix
@@ -587,13 +587,13 @@ ngx_feature_libs=
# C types
-ngx_type="int"; . auto/types/sizeof
+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
-ngx_type="long"; . auto/types/sizeof
+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
-ngx_type="long long"; . auto/types/sizeof
+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
@@ -604,7 +604,7 @@ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ng
ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef
ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
-ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
+ngx_type="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
. auto/types/sizeof
ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
@@ -620,15 +620,15 @@ ngx_type="rlim_t"; ngx_types="int"; . au
. auto/endianness
-ngx_type="size_t"; . auto/types/sizeof
+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
-ngx_type="off_t"; . auto/types/sizeof
+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
-ngx_type="time_t"; . auto/types/sizeof
+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value

View File

@@ -0,0 +1,99 @@
Description: Fix NGINX pidfile handling
Author: Tj <ubuntu@iam.tj>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864
Last-Update: 2019-06-04
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Upstream-Status: Pending
This patch is from ubuntu, https://github.com/aroth-arsoft/pkg-nginx/blob
/master/debian/patches/nginx-fix-pidfile.patch, for fix below
error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument
Signed-off-by: Changqing Li <changqing.li@windriver.com>
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 9fcb0eb2..083eba1d 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -338,14 +338,21 @@ main(int argc, char *const *argv)
ngx_process = NGX_PROCESS_MASTER;
}
+ /* tell-tale to detect if this is parent or child process */
+ ngx_int_t child_pid = NGX_BUSY;
+
#if !(NGX_WIN32)
if (ngx_init_signals(cycle->log) != NGX_OK) {
return 1;
}
+ /* tell-tale that this code has been executed */
+ child_pid--;
+
if (!ngx_inherited && ccf->daemon) {
- if (ngx_daemon(cycle->log) != NGX_OK) {
+ child_pid = ngx_daemon(cycle->log);
+ if (child_pid == NGX_ERROR) {
return 1;
}
@@ -358,8 +365,19 @@ main(int argc, char *const *argv)
#endif
- if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
- return 1;
+ /* If ngx_daemon() returned the child's PID in the parent process
+ * after the fork() set ngx_pid to the child_pid, which gets
+ * written to the PID file, then exit.
+ * For NGX_WIN32 always write the PID file
+ * For others, only write it from the parent process */
+ if (child_pid < NGX_OK || child_pid > NGX_OK) {
+ ngx_pid = child_pid > NGX_OK ? child_pid : ngx_pid;
+ if (ngx_create_pidfile(&ccf->pid, cycle->log) != NGX_OK) {
+ return 1;
+ }
+ }
+ if (child_pid > NGX_OK) {
+ exit(0);
}
if (ngx_log_redirect_stderr(cycle) != NGX_OK) {
diff --git a/src/os/unix/ngx_daemon.c b/src/os/unix/ngx_daemon.c
index 385c49b6..3719854c 100644
--- a/src/os/unix/ngx_daemon.c
+++ b/src/os/unix/ngx_daemon.c
@@ -7,14 +7,17 @@
#include <ngx_config.h>
#include <ngx_core.h>
+#include <unistd.h>
ngx_int_t
ngx_daemon(ngx_log_t *log)
{
int fd;
+ /* retain the return value for passing back to caller */
+ pid_t pid_child = fork();
- switch (fork()) {
+ switch (pid_child) {
case -1:
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "fork() failed");
return NGX_ERROR;
@@ -23,7 +26,8 @@ ngx_daemon(ngx_log_t *log)
break;
default:
- exit(0);
+ /* let caller do the exit() */
+ return pid_child;
}
ngx_parent = ngx_pid;

View File

@@ -0,0 +1,2 @@
d @NGINX_USER@ www-data 0755 /run/nginx none
d root root 0755 /var/log/nginx none

View File

@@ -0,0 +1,47 @@
user www;
worker_processes 1;
pid /run/nginx/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# SSL Settings
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
## Logging
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
## Gzip settings
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
## Virtual Host Configs
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

View File

@@ -0,0 +1,52 @@
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
NAME=nginx
DESC=nginx
PID=/run/nginx/nginx.pid
test -x $DAEMON || exit 0
# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile $PID \
--name $NAME --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon -K --quiet --pidfile $PID \
--name $NAME
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon -K --quiet --pidfile $PID \
--name $NAME
sleep 1
start-stop-daemon --start --quiet --pidfile $PID \
--name $NAME --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \
--exec $DAEMON
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -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/nginx.pid
ExecStartPre=@SBINDIR@/nginx -t
ExecStart=@SBINDIR@/nginx
ExecReload=@SBINDIR@/nginx -s reload
ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,4 @@
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;