Importing nginx-0.8.13 to this overlay.
This commit is contained in:
40
www-servers/nginx/files/nginx
Normal file
40
www-servers/nginx/files/nginx
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx,v 1.3 2005/05/29 14:30:28 voxus Exp $
|
||||
|
||||
opts="${opts} reload configtest"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger
|
||||
}
|
||||
|
||||
start() {
|
||||
configtest || return 1
|
||||
ebegin "Starting nginx"
|
||||
start-stop-daemon --start --pidfile /var/run/nginx.pid \
|
||||
--exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf
|
||||
eend $? "Failed to start nginx"
|
||||
}
|
||||
|
||||
stop() {
|
||||
configtest || return 1
|
||||
ebegin "Stopping nginx"
|
||||
start-stop-daemon --stop --pidfile /var/run/nginx.pid
|
||||
eend $? "Failed to stop nginx"
|
||||
rm -f /var/run/nginx.pid
|
||||
}
|
||||
|
||||
reload() {
|
||||
configtest || return 1
|
||||
ebegin "Refreshing nginx' configuration"
|
||||
kill -HUP `cat /var/run/nginx.pid` &>/dev/null
|
||||
eend $? "Failed to reload nginx"
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking nginx' configuration"
|
||||
/usr/sbin/nginx -c /etc/nginx/nginx.conf -t
|
||||
eend $? "failed, please correct errors above"
|
||||
}
|
71
www-servers/nginx/files/nginx-r1
Normal file
71
www-servers/nginx/files/nginx-r1
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/sbin/runscript
|
||||
# Copyright 1999-2004 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx-r1,v 1.1 2006/07/04 16:58:38 voxus Exp $
|
||||
|
||||
opts="${opts} upgrade reload configtest"
|
||||
|
||||
depend() {
|
||||
need net
|
||||
use dns logger
|
||||
}
|
||||
|
||||
start() {
|
||||
configtest || return 1
|
||||
ebegin "Starting nginx"
|
||||
start-stop-daemon --start --pidfile /var/run/nginx.pid \
|
||||
--exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf
|
||||
eend $? "Failed to start nginx"
|
||||
}
|
||||
|
||||
stop() {
|
||||
configtest || return 1
|
||||
ebegin "Stopping nginx"
|
||||
start-stop-daemon --stop --pidfile /var/run/nginx.pid
|
||||
eend $? "Failed to stop nginx"
|
||||
rm -f /var/run/nginx.pid
|
||||
}
|
||||
|
||||
reload() {
|
||||
configtest || return 1
|
||||
ebegin "Refreshing nginx' configuration"
|
||||
kill -HUP `cat /var/run/nginx.pid` &>/dev/null
|
||||
eend $? "Failed to reload nginx"
|
||||
}
|
||||
|
||||
upgrade() {
|
||||
configtest || return 1
|
||||
ebegin "Upgrading nginx"
|
||||
|
||||
einfo "Sending USR2 to old binary"
|
||||
kill -USR2 `cat /var/run/nginx.pid` &>/dev/null
|
||||
|
||||
einfo "Sleeping 3 seconds before pid-files checking"
|
||||
sleep 3
|
||||
|
||||
if [ ! -f /var/run/nginx.pid.oldbin ]; then
|
||||
eerror "File with old pid not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f /var/run/nginx.pid ]; then
|
||||
eerror "New binary failed to start"
|
||||
return 1
|
||||
fi
|
||||
|
||||
einfo "Sleeping 3 seconds before WINCH"
|
||||
sleep 3 ; kill -WINCH `cat /var/run/nginx.pid.oldbin`
|
||||
|
||||
einfo "Sending QUIT to old binary"
|
||||
kill -QUIT `cat /var/run/nginx.pid.oldbin`
|
||||
|
||||
einfo "Upgrade completed"
|
||||
|
||||
eend $? "Upgrade failed"
|
||||
}
|
||||
|
||||
configtest() {
|
||||
ebegin "Checking nginx' configuration"
|
||||
/usr/sbin/nginx -c /etc/nginx/nginx.conf -t
|
||||
eend $? "failed, please correct errors above"
|
||||
}
|
131
www-servers/nginx/files/nginx-secure-link-timeout.patch
Normal file
131
www-servers/nginx/files/nginx-secure-link-timeout.patch
Normal file
@@ -0,0 +1,131 @@
|
||||
diff -Naur nginx-0.8.4.orig/src/http/modules/ngx_http_secure_link_module.c nginx-0.8.4/src/http/modules/ngx_http_secure_link_module.c
|
||||
--- nginx-0.8.4.orig/src/http/modules/ngx_http_secure_link_module.c 2009-05-13 14:44:15.000000000 +0200
|
||||
+++ nginx-0.8.4/src/http/modules/ngx_http_secure_link_module.c 2009-05-13 15:00:49.000000000 +0200
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
typedef struct {
|
||||
ngx_str_t secret;
|
||||
+ time_t timeout;
|
||||
} ngx_http_secure_link_conf_t;
|
||||
|
||||
|
||||
@@ -30,6 +31,12 @@
|
||||
offsetof(ngx_http_secure_link_conf_t, secret),
|
||||
NULL },
|
||||
|
||||
+ { ngx_string("secure_link_timeout"),
|
||||
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
||||
+ ngx_conf_set_sec_slot,
|
||||
+ NGX_HTTP_LOC_CONF_OFFSET,
|
||||
+ offsetof(ngx_http_secure_link_conf_t, timeout),
|
||||
+ NULL },
|
||||
ngx_null_command
|
||||
};
|
||||
|
||||
@@ -67,22 +74,36 @@
|
||||
|
||||
static ngx_str_t ngx_http_secure_link = ngx_string("secure_link");
|
||||
|
||||
+static u_char
|
||||
+ngx_hex2int(u_char hex)
|
||||
+{
|
||||
+ hex = hex - '0';
|
||||
+ if (hex > 9) {
|
||||
+ hex = (hex + '0' - 1) | 0x20;
|
||||
+ hex = hex - 'a' + 11;
|
||||
+ }
|
||||
+ if (hex > 15)
|
||||
+ hex = 0xFF;
|
||||
+
|
||||
+ return hex;
|
||||
+}
|
||||
|
||||
static ngx_int_t
|
||||
ngx_http_secure_link_variable(ngx_http_request_t *r,
|
||||
ngx_http_variable_value_t *v, uintptr_t data)
|
||||
{
|
||||
- u_char *p, *start, *end, *last;
|
||||
- size_t len;
|
||||
+ u_char *p, *start, *end, *last, *tss, *tse;
|
||||
+ size_t len, tslen;
|
||||
ngx_int_t n;
|
||||
ngx_uint_t i;
|
||||
ngx_md5_t md5;
|
||||
+ time_t ts;
|
||||
ngx_http_secure_link_conf_t *conf;
|
||||
u_char hash[16];
|
||||
|
||||
conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
|
||||
|
||||
- if (conf->secret.len == 0) {
|
||||
+ if (conf->secret.len == 0 || conf->timeout == 0) {
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
@@ -103,22 +124,46 @@
|
||||
while (p < last) {
|
||||
if (*p++ == '/') {
|
||||
end = p - 1;
|
||||
- goto url_start;
|
||||
+ goto tstamp_start;
|
||||
}
|
||||
}
|
||||
|
||||
goto not_found;
|
||||
|
||||
+ tstamp_start:
|
||||
+
|
||||
+ tss = p;
|
||||
+
|
||||
+ while (p < last) {
|
||||
+ if (*p++ == '/') {
|
||||
+ tse = p - 1;
|
||||
+ goto url_start;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ goto not_found;
|
||||
+
|
||||
url_start:
|
||||
|
||||
+ tslen = tse - tss;
|
||||
len = last - p;
|
||||
|
||||
- if (end - start != 32 || len == 0) {
|
||||
+ if (end - start != 32 || len == 0 || tslen != 8) {
|
||||
goto not_found;
|
||||
}
|
||||
|
||||
+ ts = 0;
|
||||
+ for (i = 0; i < 8; i++) {
|
||||
+ ts = (ts << 4) + ngx_hex2int(tss[i]);
|
||||
+ }
|
||||
+
|
||||
+ if (ts < r->start_sec - conf->timeout) {
|
||||
+ goto not_found;
|
||||
+ }
|
||||
+
|
||||
ngx_md5_init(&md5);
|
||||
ngx_md5_update(&md5, p, len);
|
||||
+ ngx_md5_update(&md5, tss, tslen);
|
||||
ngx_md5_update(&md5, conf->secret.data, conf->secret.len);
|
||||
ngx_md5_final(hash, &md5);
|
||||
|
||||
@@ -160,7 +205,8 @@
|
||||
*
|
||||
* conf->secret = { 0, NULL }
|
||||
*/
|
||||
-
|
||||
+
|
||||
+ conf->timeout = NGX_CONF_UNSET;
|
||||
return conf;
|
||||
}
|
||||
|
||||
@@ -172,6 +218,7 @@
|
||||
ngx_http_secure_link_conf_t *conf = child;
|
||||
|
||||
ngx_conf_merge_str_value(conf->secret, prev->secret, "");
|
||||
+ ngx_conf_merge_sec_value(conf->timeout, prev->timeout, 3600);
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
66
www-servers/nginx/files/nginx.conf
Normal file
66
www-servers/nginx/files/nginx.conf
Normal file
@@ -0,0 +1,66 @@
|
||||
user apache apache;
|
||||
|
||||
worker_processes 5;
|
||||
|
||||
error_log /var/log/nginx/error_log warn;
|
||||
|
||||
events {
|
||||
connections 2048;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '%addr - - [%time] "%request" %status '
|
||||
'%length "%{Referer}i" "%{User-Agent}i" ';
|
||||
|
||||
log_format download '%addr - - [%time] "%request" %status '
|
||||
'%length "%{Referer}i" "%{User-Agent}i" '
|
||||
'"%{Range}i" "%{Content-Range}o"';
|
||||
|
||||
post_accept_timeout 60;
|
||||
client_header_timeout 3m;
|
||||
client_body_timeout 3m;
|
||||
send_timeout 3m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
charset on;
|
||||
source_charset koi8-r;
|
||||
|
||||
access_log /var/log/nginx/access_log main;
|
||||
|
||||
location / {
|
||||
root /var/www/localhost/htdocs;
|
||||
index index.html;
|
||||
allow all;
|
||||
}
|
||||
|
||||
location ~* ^.+\.(jpg|jpeg|gif)$ {
|
||||
root /var/www/localhost/htdocs;
|
||||
access_log off;
|
||||
expires 30d;
|
||||
}
|
||||
}
|
||||
}
|
55
www-servers/nginx/files/nginx.conf-r1
Normal file
55
www-servers/nginx/files/nginx.conf-r1
Normal file
@@ -0,0 +1,55 @@
|
||||
user apache apache;
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error_log info;
|
||||
|
||||
events {
|
||||
worker_connections 8192;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main
|
||||
'$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
'"$gzip_ratio"';
|
||||
|
||||
client_header_timeout 10m;
|
||||
client_body_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
ignore_invalid_headers on;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/access_log info;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
}
|
||||
}
|
58
www-servers/nginx/files/nginx.conf-r2
Normal file
58
www-servers/nginx/files/nginx.conf-r2
Normal file
@@ -0,0 +1,58 @@
|
||||
user apache apache;
|
||||
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error_log info;
|
||||
|
||||
events {
|
||||
worker_connections 8192;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main
|
||||
'$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
'"$gzip_ratio"';
|
||||
|
||||
client_header_timeout 10m;
|
||||
client_body_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
ignore_invalid_headers on;
|
||||
|
||||
index index.html;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/localhost.access_log main;
|
||||
error_log /var/log/nginx/localhost.error_log;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
}
|
||||
}
|
57
www-servers/nginx/files/nginx.conf-r3
Normal file
57
www-servers/nginx/files/nginx.conf-r3
Normal file
@@ -0,0 +1,57 @@
|
||||
user nginx nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error_log info;
|
||||
|
||||
events {
|
||||
worker_connections 8192;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main
|
||||
'$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
'"$gzip_ratio"';
|
||||
|
||||
client_header_timeout 10m;
|
||||
client_body_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
ignore_invalid_headers on;
|
||||
|
||||
index index.html;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/localhost.access_log main;
|
||||
error_log /var/log/nginx/localhost.error_log;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
}
|
||||
}
|
72
www-servers/nginx/files/nginx.conf-r4
Normal file
72
www-servers/nginx/files/nginx.conf-r4
Normal file
@@ -0,0 +1,72 @@
|
||||
user nginx nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error_log info;
|
||||
|
||||
events {
|
||||
worker_connections 8192;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main
|
||||
'$remote_addr - $remote_user [$time_local] '
|
||||
'"$request" $status $bytes_sent '
|
||||
'"$http_referer" "$http_user_agent" '
|
||||
'"$gzip_ratio"';
|
||||
|
||||
client_header_timeout 10m;
|
||||
client_body_timeout 10m;
|
||||
send_timeout 10m;
|
||||
|
||||
connection_pool_size 256;
|
||||
client_header_buffer_size 1k;
|
||||
large_client_header_buffers 4 2k;
|
||||
request_pool_size 4k;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1100;
|
||||
gzip_buffers 4 8k;
|
||||
gzip_types text/plain;
|
||||
|
||||
output_buffers 1 32k;
|
||||
postpone_output 1460;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
keepalive_timeout 75 20;
|
||||
|
||||
ignore_invalid_headers on;
|
||||
|
||||
index index.html;
|
||||
|
||||
server {
|
||||
listen 127.0.0.1;
|
||||
server_name localhost;
|
||||
|
||||
access_log /var/log/nginx/localhost.access_log main;
|
||||
error_log /var/log/nginx/localhost.error_log info;
|
||||
|
||||
root /var/www/localhost/htdocs;
|
||||
}
|
||||
|
||||
##ssl portion
|
||||
# server {
|
||||
# listen 127.0.0.1:443;
|
||||
# server_name localhost;
|
||||
#
|
||||
# ssl on;
|
||||
# ssl_certificate /etc/ssl/nginx/nginx.pem;
|
||||
# ssl_certificate_key /etc/ssl/nginx/nginx.key;
|
||||
#
|
||||
# access_log /var/log/nginx/localhost.ssl_access_log main;
|
||||
# error_log /var/log/nginx/localhost.ssl_error_log info;
|
||||
#
|
||||
# root /var/www/localhost/htdocs;
|
||||
# }
|
||||
}
|
Reference in New Issue
Block a user