diff --git a/www-servers/nginx/Manifest b/www-servers/nginx/Manifest index 73df564..3014434 100644 --- a/www-servers/nginx/Manifest +++ b/www-servers/nginx/Manifest @@ -1,3 +1,7 @@ +AUX nginx-0.6-mod_wsgi.patch 1342 RMD160 0666346df284508715735806c0551cab242621a1 SHA1 06b83b7b89235a59381eade9073a7b26452759c5 SHA256 83489742497e9d2cd8cac477d915ade40778ed02b819cc35256bce659c5a6837 +AUX nginx-r1 1645 RMD160 d032feec43e4ba31ac5b6fffec478ebbeb49db60 SHA1 49f0db3efaccd3cef545b8c68cfa557ca829352f SHA256 b263a663399d2897dfdf53226d45fc3707bc9230bd687b8003d075a48f60ecaf +AUX nginx.conf-r4 1410 RMD160 4b188bb03b12de3b38a82e13b1a2bb93848e8948 SHA1 e836c85e98e3b2c633818c286992d32a68c0b5ff SHA256 74d984512901fc9cfd13cac60df06cd468566aae367c35a3205e6daf7e7c32b6 +AUX use_x_forwarded_host.patch 2762 RMD160 37376f7ebd16c4041899a894b6366b146879ad88 SHA1 c844c8ea06cbcb56ee2d909febb17238a10622d8 SHA256 9734c205102dfbf0dce8d198fc9f0d9b21158e0f69fa26ae9becb99a3eb0b9c0 DIST mod_scgi-b466baa5fcdb.tar.gz 10947 RMD160 dcf8f5dae78a1ec068afcc1f0b35dca093db5ba7 SHA1 b2eae98cd08675da21ee1f58ecab50574f9ba1fe SHA256 d6172ae5ce7608d9fe0e08f0e43debf6f24857216e8c4a420a1e6b1deb0ddd3f DIST mod_wsgi-8994b058d2db.tar.gz 52044 RMD160 e879e5a5cfe462ba4902893cdb740e0b92a23e6d SHA1 2c2c46116d1f0e2619b8b72d54297e65b1d126cd SHA256 15419c1a188d1c11f36ca460c975eba3a0cc9f25e9a8b8ab7bd0e13a5ae50cb3 DIST nginx-0.7.58.tar.gz 592868 RMD160 d58ad06852a52b8eadae49204a4a48bd27d58b91 SHA1 ec7a3038ea3f7c6c1dc7f7f54acae652319da7f3 SHA256 9bfeb136eb28127a0cceaf1bcbf78ff0dc043371ee69470fd967a2d706a6cc42 diff --git a/www-servers/nginx/files/nginx-0.6-mod_wsgi.patch b/www-servers/nginx/files/nginx-0.6-mod_wsgi.patch new file mode 100644 index 0000000..1fed494 --- /dev/null +++ b/www-servers/nginx/files/nginx-0.6-mod_wsgi.patch @@ -0,0 +1,44 @@ +diff -r 8994b058d2db examples/nginx.conf +--- a/examples/nginx.conf Wed Mar 26 20:35:15 2008 +0100 ++++ b/examples/nginx.conf Fri May 02 01:37:33 2008 +0200 +@@ -14,7 +14,7 @@ + env PYTHONPATH=/some/path; + + http { +- include conf/mime.types; ++ include mime.types; + default_type application/octet-stream; + + #log_format main '$remote_addr - $remote_user [$time_local] $request ' +@@ -31,8 +31,8 @@ + + gzip off; + #ssl on; +- #ssl_certificate conf/server.crt; +- #ssl_certificate_key conf/server.key; ++ #ssl_certificate server.crt; ++ #ssl_certificate_key server.key; + + wsgi_python_optimize 0; + #wsgi_python_executable /usr/bin/python; +@@ -44,7 +44,7 @@ + server_name localhost; + + +- include conf/wsgi_vars; ++ include wsgi_vars; + + #wsgi_middleware wsgiref.validate validator; + #wsgi_middleware paste.lint; +diff -r 8994b058d2db src/ngx_http_wsgi_handler.c +--- a/src/ngx_http_wsgi_handler.c Wed Mar 26 20:35:15 2008 +0100 ++++ b/src/ngx_http_wsgi_handler.c Fri May 02 01:37:33 2008 +0200 +@@ -71,7 +71,7 @@ + + if (r->method == NGX_HTTP_GET || r->method == NGX_HTTP_HEAD) { + /* XXX not sure */ +- rc = ngx_http_discard_body(r); ++ rc = ngx_http_discard_request_body(r); + + if (rc != NGX_OK && rc != NGX_AGAIN) { + return rc; diff --git a/www-servers/nginx/files/nginx-r1 b/www-servers/nginx/files/nginx-r1 new file mode 100644 index 0000000..ceea5d8 --- /dev/null +++ b/www-servers/nginx/files/nginx-r1 @@ -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" +} diff --git a/www-servers/nginx/files/nginx.conf-r4 b/www-servers/nginx/files/nginx.conf-r4 new file mode 100644 index 0000000..117c2e5 --- /dev/null +++ b/www-servers/nginx/files/nginx.conf-r4 @@ -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; + # } +} diff --git a/www-servers/nginx/files/use_x_forwarded_host.patch b/www-servers/nginx/files/use_x_forwarded_host.patch new file mode 100644 index 0000000..f3be562 --- /dev/null +++ b/www-servers/nginx/files/use_x_forwarded_host.patch @@ -0,0 +1,74 @@ +diff -r e24850f69497 src/http/ngx_http.c +--- a/src/http/ngx_http.c Tue Jan 22 11:49:18 2008 +0100 ++++ b/src/http/ngx_http.c Sun Feb 10 11:14:22 2008 +0100 +@@ -363,6 +363,22 @@ ngx_http_block(ngx_conf_t *cf, ngx_comma + hk->value = header; + } + ++ if (cmcf->use_x_forwarded_host) { ++ /* Use the X-Forwarded-Host instead of the Host header */ ++ ngx_http_header_t *header = ngx_palloc(cf->pool, sizeof(ngx_http_header_t)); ++ ++ header->name.data = (u_char *) "X-Forwarded-Host"; ++ header->name.len = sizeof("X-Forwarded-Host") - 1; ++ header->offset = offsetof(ngx_http_headers_in_t, host); ++ header->handler = ngx_http_headers_in[0].handler; ++ ++ hk = headers_in.elts; ++ ++ hk->key = header->name; ++ hk->key_hash = ngx_hash_key_lc(header->name.data, header->name.len); ++ hk->value = header; ++ } ++ + hash.hash = &cmcf->headers_in_hash; + hash.key = ngx_hash_key_lc; + hash.max_size = 512; +diff -r e24850f69497 src/http/ngx_http_core_module.c +--- a/src/http/ngx_http_core_module.c Tue Jan 22 11:49:18 2008 +0100 ++++ b/src/http/ngx_http_core_module.c Sun Feb 10 11:14:22 2008 +0100 +@@ -92,6 +92,13 @@ static ngx_conf_enum_t ngx_http_core_re + + static ngx_command_t ngx_http_core_commands[] = { + ++ { ngx_string("use_x_forwarded_host"), ++ NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG, ++ ngx_conf_set_flag_slot, ++ NGX_HTTP_MAIN_CONF_OFFSET, ++ offsetof(ngx_http_core_main_conf_t, use_x_forwarded_host), ++ NULL }, ++ + { ngx_string("variables_hash_max_size"), + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, +@@ -2144,6 +2151,8 @@ ngx_http_core_create_main_conf(ngx_conf_ + return NGX_CONF_ERROR; + } + ++ cmcf->use_x_forwarded_host = NGX_CONF_UNSET; ++ + cmcf->server_names_hash_max_size = NGX_CONF_UNSET_UINT; + cmcf->server_names_hash_bucket_size = NGX_CONF_UNSET_UINT; + +@@ -2159,6 +2168,10 @@ ngx_http_core_init_main_conf(ngx_conf_t + { + ngx_http_core_main_conf_t *cmcf = conf; + ++ if (cmcf->use_x_forwarded_host == NGX_CONF_UNSET) { ++ cmcf->use_x_forwarded_host = 0; ++ } ++ + if (cmcf->server_names_hash_max_size == NGX_CONF_UNSET_UINT) { + cmcf->server_names_hash_max_size = 512; + } +diff -r e24850f69497 src/http/ngx_http_core_module.h +--- a/src/http/ngx_http_core_module.h Tue Jan 22 11:49:18 2008 +0100 ++++ b/src/http/ngx_http_core_module.h Sun Feb 10 11:14:22 2008 +0100 +@@ -99,6 +99,7 @@ typedef struct { + + ngx_array_t variables; /* ngx_http_variable_t */ + ++ ngx_flag_t use_x_forwarded_host; + ngx_uint_t server_names_hash_max_size; + ngx_uint_t server_names_hash_bucket_size; +