Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all 7229 articles
Browse latest View live

Problem trying to rewrite a URL (no replies)

$
0
0
Hi all,

I have a problem trying to rewrite a URL.

It should be pretty straightforward but it has been taking me hours
searching.

Google indexed urls containing ";", which gets escaped to %3b:

http://hoidulich.com/index.php?action=tagged%3bid=254715%3btag=vietholiday
(the original url that works is
http://hoidulich.com/index.php?action=tagged;id=254715;tag=vietholiday)

How can I fix it?
Thank you very much.
Cao Tri.

OT: OpenSSL 1.0.1f (1 reply)

$
0
0
OpenSSL 1.0.1f was released today. It might be a good time to rebuild
all the versions of nginx using static versions of OpenSSL.

There are three CVE remediations included in the release:
CVE-2013-4353, CVE-2013-6449, CVE-2013-6450.
http://www.openssl.org/news/openssl-1.0.1-notes.html.

It does not look like 1.0.1f changed the default behavior of
ENGINE_rdrand (coderman's been following it).

1.0.1f added hostname and email verification routines so programs no
longer have to do it themselves.

There's also an Apple SecureTransport bug workaround. Apple's
SecrureTransport does not properly negotiate ECDHE-ECDSA cipher
suites. It affects Mac OS X and could affect iOS. It might be prudent
to add SSL_OP_SAFARI_ECDHE_ECDSA_BUG by default.
http://www.mail-archive.com/openssl-dev@openssl.org/msg32629.html.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

how to submit my open source nginx module to nginx thrid party modules (1 reply)

$
0
0
i want to submit my open souce nginx module to
http://wiki.nginx.org/3rdPartyModules, how can i do ?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Request body in a module (no replies)

$
0
0
Hi, have been trying to read the request body in my module, using the information I have gotten from this forum and some blogs and basically came up with the following functions
as can be seen in this post http://forum.nginx.org/read.php?11,245953. The problem is that the request_body.bufs seem to contain no data.

If I check the request body with the following conf:

log_format my_tracking $request_body;


location /dd {
access_log logs/postdata.log my_tracking;
proxy_pass http://127.0.0.1:8081/temp_service;
}

location /demo {
access_log logs/postdata.log my_tracking;
demo;
}

I get the request_boody logged in the first /dd post request but in the second /demo I do not get anything logged if I post data
Use the following command the trying it out: curl -v --request POST -d "a=b" http://localhost:8080/dd
Anyone that have an idea what can be wrong?

Best Regards
Christer

proxy_pass check if 404, and return 404 (3 replies)

$
0
0
I am using proxy_pass to a dynamic subdomain:

proxy_pass https://$remote_user.mydomain.io

Is it possible to have the proxy_pass check if the response of https://$remote_user.mydomain.io is 404, if so, simply do:

return 404;

I.E. don't proxy, immediately return.

Empty error log (2 replies)

$
0
0
I have installed Nginx for a small web server with static content. It works fine but the site error log file is always empty. All errors such as 404 are written to the access log only. File grants are the same for access and error logs.

I've tried to change error_log param from "error" to "warn" and that didn't help. But changing it to "debug" was successful: log was filled with debug info (but no error info).

My config files:


/etc/nginx/nginx.conf:

user www;
worker_processes 2;
pid /var/run/nginx.pid;

events {
worker_connections 768;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
gzip_min_length 200;
gzip_types text/plain text/css application/json
application/x-javascript text/xml application/xml application/xml+rss
text/javascript application/rdf+xml;

include/etc/nginx/conf.d/*.conf; # None
include/etc/nginx/sites-enabled/*; # One
}


/etc/nginx/sites-available/mysite.conf:

server {
listen 80;
root /var/www/mysite;
index index.html index.htm;
server_name mysite.org;
access_log /var/log/nginx/mysite_access.log combined;
error_log /var/log/nginx/mysite_error.log error;
log_subrequest on;
location / {
try_files $uri $uri/ =404;
autoindex off;
}
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

How to combine try_files with multiple proxy destinations (no replies)

$
0
0
I have the folllowing requirement:
1. if /usr/share/nginx/html/maintenance.html exists, then always show this file to browser.
2. if this is the static file which located in the sub-directories of /usr/share/nginx/html/, then show this static file to browser.
3. if the URI begins with /testapp1/, then proxy to http://127.0.0.1:8080; else proxy to http://127.0.0.1:8081

And I tried the following two configurations but both failed:
1. Config1
server {
...
root /usr/share/nginx/html/;
location / {
try_files /maintenance.html $uri @proxy;
}

location @proxy {
location /testapp/ {
proxy_pass http://127.0.0.1:8080;
}

location / {
proxy_pass http://127.0.0.1:8081
}
}
}

2. Config2
server {
...
root /usr/share/nginx/html/;
try_files /maintenance.html $uri @proxy;

location /testapp/ {
proxy_pass http://127.0.0.1:8080;
}

location / {
proxy_pass http://127.0.0.1:8081
}
}

For Config1, it throws the following error:
nginx: [emerg] location "/testapp/" cannot be inside the named location "@proxy" in /etc/nginx/nginx.conf:41

For Config2, it does not work as expected: it seems that when try_files is together with location directives, try_file has the lowerest priority and so I can never get /maintenance.html shown.

So can anybody know how to config to meet my requirement ? Thanks in advance!

[ANNOUNCE] Tengine-2.0.0 is released (no replies)

$
0
0
Hi folks,

We are glad to announce that Tengine-2.0.0 (development version) has been
released. You can either checkout the source code from GitHub:
https://github.com/alibaba/tengine or download the tarball directly:
http://tengine.taobao.org/download/tengine-2.0.0.tar.gz

The highlights of this release are support for SPDY v3 (flow control), and
enhanced DSO module.
Tengine is now based on Nginx-1.4.4.

The full changelog is as follows:
*) Feature: now DSO module does not need the original source code or
compiler options when compiling a new module. (monadbobo)
*) Feature: added support for SPDY v3, and SPDY/HTTP servers can listen on
the same port. (lilbedwin、chobits)
*) Feature: added support for setting retries for upstream servers (proxy,
memcached, fastcgi, scgi, uwsgi). (supertcy)
*) Feature: now tfs module can report access status to rcs while keepalive.
(zhcn381)
*) Feature: now the directive "if" supports ">", "<", ">=", "<=" operators
for numeric comparison. (flygoast)
*) Feature: now upstream health check module uses keep-alive connections.
(lilbedwin)
*) Feature: now trim module can handle SSI and ESI comments properly.
(taoyuanyuan)
*) Feature: now directive "expires_by_types" supports wildcard such as
"text/*". (zhcn381)
*) Feature: added variables starting with "$base64_decode_" to encode
variables in base64. (yzprofile)
*) Feature: added variables starting with "$md5_encode_" to encode
variables in md5. (yzprofile)
*) Feature: added a variable "$time_http" to get the current HTTP time.
(flygoast)
*) Feature: added a variable "$full_request" to get the original request
URL with scheme and host. (yzprofile)
*) Feature: added variables starting with "$escape_uri_" to escape
variables into formal URL syntax. (yzprofile)
*) Feature: added a variable "$raw_uri" to get the original URI without
arguments. (flygoast)
*) Feature: added support for logging subrequests in nanoseconds. (jinglong)
*) Feature: added a new API function to encode URL into base64. (lilbedwin)
*) Change: merged changes between nginx-1.2.9 and nginx-1.4.4. (cfsego)
*) Change: now stub_status module does not log subrequests. (jinglong)
*) Bugfix: fixed a bug in footer module when reading a response with a
"Content-Encoding" header. (yaoweibin)
*) Bugfix: fixed a bug when "client_body_postpone_size" is set to 0.
(yaoweibin)
*) Bugfix: fixed a compilation warning of Lua module. (diwayou)

For those who don't know Tengine, it is a free and open source distribution
of Nginx with some advanced features. See our website for more details:
http://tengine.taobao.org

Have fun!

Regards,
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

proxy_cache incorrectly returning 304 Not Modified (no replies)

$
0
0
Hi there,

I work on a site which has nginx in front of a Rails application, and we
use proxy_cache.

For the home page, our application returns a "max-age=600, public"
Cache-Control header, and we have nginx configured to cache the response
using proxy_cache.

This generally works fine, but last night nginx started to respond with
304 Not Modified to requests that *didn't* include any caching headers
(If-Modified-Since or ETag). Our Pingdom alerts showed this issue, and
here is the request/response captured:

GET / HTTP/1.0
User-Agent: Pingdom.com_bot_version_1.4_(http://www.pingdom.com/)
Host: loco2.com

304 Not Modified
Cache-Control: max-age=600, public
Date: Tue, 07 Jan 2014 22:59:32 GMT
ETag: "900e1f11422519337c9ed25fad299ce0"
Server: nginx/1.4.4
Status: 304 Not Modified
Strict-Transport-Security: max-age=31536000
X-Cache-Status: HIT
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: c7ee78ab-df49-4467-bced-753b2cc622ab
X-UA-Compatible: chrome=1
X-XSS-Protection: 1; mode=block
Connection: Close

Does this look like a bug? Or could it be a configuration issue? I can't
think of any reason why this should be the correct thing for the proxy
cache to do.

Many thanks,

Jon

--
http://jonathanleighton.com/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Time out errors using uwsgi with ngnix on debian 7 (wheezy) (2 replies)

$
0
0
I've installed nginx via apt, using the nginx stable pkg as described here:
http://nginx.org/en/linux_packages.html#stable

It works perfectly for serving static files using the default configuration.

Next, I installed uwsgi from source, as described here:
https://pypi.python.org/pypi/uWSGI/1.2.3

When I do the steps in the python quickstart guide --
http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html -- and open
my browser to localhost:9090, everything works as expected.

When I change the nginx config file to use uwsgi_pass to localhost:9090 as
described here --
http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html#putting-behind-a-full-webserver--
however, I get time out errors:

> upstream timed out (110: Connection timed out) while reading response
header from upstream

It is as though nginx is *not* passing those requests to the uwsgi process
(which is still running).

Here is the content of server{ } inside the nginx config file:

location / {
include uwsgi_params;
uwsgi_pass localhost:9090;
}

Any ideas on what the problem might be?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

"Primary script unknown" wp-login.php (3 replies)

$
0
0
As subject says: I cannot access wp-admin due to above [error].
Otherwise, site functions as it should.

See error log:
2014/01/09 04:31:23 [error] 35759#0: *5254 FastCGI sent in stderr:
"Primary script unknown" while reading response header from upstream,
client: ipaddress, server: hostname, request: "GET
/wordpress/wp-login.php HTTP/1.1", upstream:
"fastcgi://unix:/var/run/php-fpm.sock:", host: "hostname", referrer:
"http://hostname/"


See access.log
[09/Jan/2014:04:31:23 +0000] "GET /wordpress/wp-login.php HTTP/1.1" 404
27 "hostname" "useragent" "-"


See nginx.conf
user www;
worker_processes 1;
error_log logs/error.log info;
pid /var/run/nginx.pid;

events {
worker_connections 768;
}

http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local]
"$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/access.log main;
sendfile on;
tcp_nopush off;
keepalive_timeout 65;
gzip off;

server {
listen 80;
listen 443 ssl;
server_name hostname;
root /usr/local/www;
ssl_certificate /path/to/crt-chain.pem;
ssl_certificate_key /path/to/privatekey.pem;
ssl_dhparam /pth/to/dhparam4096.pem;
server_name hostname www.hostnam;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM
EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384
EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW
!3DES !MD5 !EXP !PSK !SRP !DSS !RC4";
ssl_prefer_server_ciphers on;
access_log logs/access.log main;
charset utf-8;

location / {
root /usr/local/www/wordpress;
try_files $uri $uri/ /index.php?q=$uri&$args;
index index.php index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/www/nginx-dist;
}

location ~ \.(js|css|png|jpg|jpeg|gif|ico|html)$ {
expires max;
}

location ~ \.php$ {
root html;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/usr/local/www/wordpress$fastcgi_script_name;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}
}


See fastcgi_params:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;


Please advise my mistake and how to fix. Thank you.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

SSL ciphers, disable or not to disable RC4? (16 replies)

$
0
0
Hi

My current values in my nginx configuration for ssl_protocols/ciphers what
i use is this:

ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

What are todays recommendations for ssl_ciphers option for supporting all
current OSes and browsers, even Windows XP users with IE?
Can i disable RC4?

My nginx is compiled with OpenSSL v1.0.1._______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Nginx as reverse Proxy, remove X-Frame-Options header (12 replies)

$
0
0
Hello,

I have a closed-source Webapp that run on an IIS-Webserver and send a
"X-Frame-Options: SAMEORIGIN" header.
I also have to implement this Webapp in my own, Frame based Application.

So I try to use nginx as a reverse Proxy, but the X-Frame-Options Header
is still send.
How can I remove his header?
I have try "proxy_hide_header X-Frame-Options;" without success.

Regards,
Basti

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Nginx, Lua and blocking libraries (2 replies)

$
0
0
Hello

I'm considering the possibility of implementing a project using Nginx
and the Lua module. One of the requirements of the project is that the
code must use an embedded database such as SQLite. However, as known,
using the lua-sqlite3 library directly is not optimal because it would
block the Nginx worker process.

My question is, is there a way to work around this in any way? For
example, creating a coroutine to run the lua-sqlite3 calls?

If not, does anyone know of some other embedded database that works well
with the Lua Nginx module?

Thank you in advance,
Andre

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Dynamic ssl certificate ? (wildcard+ multiple different certs) (6 replies)

$
0
0
Hello,

Here is my current conf

server {
listen 443;

server_name ~^(.*)\.sub\.domain\.com$

ssl on;
ssl_certificate $cookie_ident/$1.crt;
ssl_certificate_key $cookie_ident/$1.key;
server_tokens off;

ssl_protocols TLSv1.2 TLSv1.1 TLSv1 SSLv3;
ssl_prefer_server_ciphers on;
ssl_session_timeout 5m;
ssl_session_cache builtin:1000 shared:SSL:10m;

ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDH-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:RC4-SHA;

autoindex off;
root /upla/http/www.domain.com;
port_in_redirect off;
expires 10s;
#add_header Cache-Control "no-cache,no-store";
#expires max;
add_header Pragma public;
add_header Cache-Control "public";

location / {

try_files $uri /$request_uri =404;

}

}

I would like to be able to "load" the right cert according to the cookie set and request uri.

A sort of dynamic setting.

But of course, when I start nginx, it complains :
SSL: error:02001002:system library:fopen:No such file or directory:

Perfectly normal since $cookie_ident is empty and no subdomain has been requested.

So, what is the workaround I could use to avoid creating one file per new (self-signed)certificate issued ?

I cannot use only one certificate for all since I have to be able to revoke the certs with granularity.


How should I make it work ?

Thanks

config issue (1 reply)

$
0
0
Im trying to set up nginx with django. This is the instruction given:

Symlink to this file from /etc/nginx/sites-enabled so nginx can see it:

sudo ln -s ~/path/to/your/mysite/mysite_nginx.conf
/etc/nginx/sites-enabled/

The problem is this folder doesn't exist: /etc/nginx/sites-enabled/

my only nginx folder is in "/usr/local/nginx" so i don't know what to
do (I'm on ubuntu btw.) I've tried including the file it wanted me to
symlink, into my nginx.conf via an "Include" statement but everytime i
reload nginx, this Include action is causing an error.

What can i do to make nginx see my django project's config file?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

One link/area on a https site with a different SSL config? (1 reply)

$
0
0
Hi,

On a Wordpress website that works with a basic StartSSL certificate I
wonder if it is possible to configure nginx (1.4.4) to use a separate
self-signed cert with client certificate authentication for wp-login.php
and any link in wp-admin/ ?

So the regular https://blog.example.org/[some/link] uses the StartSSL
cert for the https session

But the https://blog.example.org/wp-login.php and
https://blog.example.org/wp-admin/* use a self-signed certficate with
client certificate authentication for the https session

Is that possible? If yes, any keywords or what to read up on are much
appreciated.

Thanks,
Patrick

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

geoip_country_code header is deleted when I set another custom header (2 replies)

$
0
0
Hello everybody.
I have a nginx (version: nginx/0.7.67) running as a loadbalancer for two tomcat7 servers with the geoip module. It was working correctly until I changed the configuration file placed in available-locations called default (we work only with the default one). The changes were made to detect mobile traffic and include a custom header. Changes are shown below:


## BEGIN DEFAULT ##

#--->content added after "server{"

server {
set $mobile_flag NO;

## regex for determining if it is mobile traffic ##
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino") {
set $mobile_flag YES;
}

if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-)") {
set $mobile_flag YES;
}

...

#-->line added after "menosbasico;"

location / {
proxy_pass http://xx;
access_log /var/log/nginx/xx.access.log menosbasico;
proxy_set_header ismobiletraffic $mobile_flag;
}

## END DEFAULT FILE ##

The proxy_set_header directive for geoip is placed in nginx.conf

## BEGIN NGINX.CONF ##

...
...

http {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
rewrite_log on;

proxy_set_header X-Forwarded-For $remote_addr;

geoip_country /usr/share/GeoIP/GeoIP.dat;
proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;

...
...

## END NGINX.CONF ##

The problem is that now, the ismobiletraffic header is set correctly, but the geoip headers have disspeared from the request. Seems to have been overwritten. Should I place the mobile traffic detection on NGINX.CONF at http{ } level? I have been looking for a solution but I didn't find anything helpful. Thanks in advance for your tips and advices!

Thanks,

Marcos.

[ANN] Windows nginx 1.5.9.1 Cheshire (no replies)

$
0
0
14:05 10-1-2014: nginx 1.5.9.1 Cheshire

When she sleeps she gently purrs, you hardly know she's there, but when she wakes
you're gonna hear her roar. nginx Cheshire release is here !
This native build runs on Windows XP SP3 and higher, both 32 and 64 bit.

Based on nginx 1.5.9 (4-1-2014) with;
+ changed compile order
+ prove01.zip (onsite), a Windows Test_Suite way to show/prove it all really works
+ ngx_http_auth_ldap2 (experimental, https://github.com/kvspb/nginx-auth-ldap)
follow examples on github site, not the site example in example.conf, this is an
experimental build addition ! (when not used it won't affect anything else)
+ set-misc-nginx-module (https://github.com/agentzh/set-misc-nginx-module)
+ headers-more-nginx-module (https://github.com/agentzh/headers-more-nginx-module)
+ openssl-1.0.1f (upgraded 8-1-2014)
+ lua-nginx-module v0.9.4 (upgraded 9-1-2014)
+ Streaming with nginx-rtmp-module, v1.1.1 (upgraded 10-1-2014)
+ echo-nginx-module v0.50 (upgraded 8-1-2014)
- RDNS has been removed until a blocking issue has been resolved
+ added http_auth_request_module
+ Source changes back ported
+ Source changes add-on's back ported
* Additional specifications are like 19:46 18-12-2013: nginx 1.5.8.3 Caterpillar

Builds can be found here:
http://nginx-win.ecsds.eu/

perl regex to extract "domain" and "extension" into variables from 'server_name' (no replies)

$
0
0
I want to extract just the "domain" and "extension" parts from an nginx
server_name for use as variables later in nginx conf.

For example,

server_name <some PERL regex ... ?<domain> ... ?<extension>
...>;
...
location = /test.html {
alias /local/path/to/$domain.$extension.html;
}

No matter what the server_name contains, from

mydomain.tld

to

https://www.mydomain.tld:80/something

and variations in between,the result should be

$domain = mydomain
$extension = tld

I found this post

"Perl Regex to get the root domain of a URL"
http://stackoverflow.com/questions/15627892/perl-regex-to-get-the-root-domain-of-a-url

that suggest this perl regex

^.*://(?:[wW]{3}\.)?([^:/]*).*$

works to extract & return "domain.tld" from any from of input URI.

What's the right form of that regex in nginx's server_name to populate
<domain> and <extension> variables for subsequent use?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Viewing all 7229 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>