Hello,
I have a fresh new installation of nginx on ubuntu 8.04 (installed via
apt-get, I believe it is 0.5.x something)
In my nginx.conf file I have gzip turned on, now I wanted to do a basic test
and serving a static html file, but the file does not come compressed at
all.
Here's the snippet of configuration, I tried variations on this without
success
gzip on;
gzip_min_length 1100;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
gzip_http_version 1.1;
gzip_comp_level 6;
Does anyone have any idea why nothing is compressed?
I've used this http://www.gidnetwork.com/tools/gzip-test.php and others to
test the results.
Thank you so much!
Can anyone recommend a good log analysis tool that is a good match for nginx? I'd like something that is flexible, where I can tell it which fields in the format are for which parts of the data (i.e. user agent is field 6) etc. Thanks! Note that I am looking for a SERVER SIDE tool to process the nginx logs (JavaScript based analytics tools will not work for this particular application).
Hello,
I have some problems running (perl) cgi scripts with nginx.
I followed the config at http://wiki.codemongers.com/NginxSimpleCGI
Perl scripts work very well as long as they use method=get in forms. If
they use method=post, it seems no input is passed to the cgi.
I saw in perl-fcgi.pl that there was some lines: "if
(($req_params{'REQUEST_METHOD'} eq 'POST') && ($req_len != 0) ){ "
Which should pass the info
Has someone an idea of what's happening?
Regards
Hi All
I'm trying to move a bunch of rails apps from an apache/fastcgi
platform to nginx/mongrel_cluster.
What I want is something like this;
http://my.server/app1 --> mongrel_cluster1
http://my.server/app2 --> mongrel_cluster2
I can do this in nginx with something like this;
...
upstream mongrel_cluster1 {
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
upstream mongrel_cluster2 {
server 127.0.0.1:4001;
server 127.0.0.1:4002;
}
server {
...
location /app1 {
proxy_pass http://mongrel_cluster1;
break;
}
location /app2 {
proxy_pass http://mongrel_cluster2;
break;
}
...
But, the problem is that I'm now hitting my rails apps with paths like
this;
/app1/controller/method
/app2/controller/method
...when the apps want the paths to be just /controller/method
So, I want to use something like this to remove the 'app1' part;
rewrite ^/app1/(.*)$ /$1 permanent;
But, that seems to override the proxy_pass directive, because if I put
that in my location blocks, I just get 404 errors, and it's not
allowed in my upstream blocks.
I know I could use virtual hosts, with a different subdomain for each
app, but that would be this;
http://app1.my.server --> mongrel_cluster1
http://app2.my.server --> mongrel_cluster2
...which is not what I want.
Is there any way to achieve what I want, using nginx?
Thanks in advance for any help.
David
Hi All!
I'm new on this nice discussion list but I'm a long time lurker.
I'm working on a very specific module for Nginx: a complete CMS. It may
sounds strange since upstream servers and scripting languages are the
norm for the CMS, but I want (and need) speed.
So far I've done many things without too much trouble, but I'm a little
bit stuck with the processing of events in Nginx. I would like to
process a specific event which is not connection related but created by
one of my worker threads.
I hope this short example will be clear:
// My specific Nginx http handler
int my_http_handler (ngx_request_t * r)
{
if (r->my_state == 0) // first step: initiate the work to do
{
r->my_state ++ ;
my_sendmsg (myqueue,r) ; // send a message to worker
return NGX_AGAIN ; // please call me back when done
}
else // second step: results are ready
{
// produce xhtml output from results
return NGX_OK ; // finished
}
}
// The worker running on a specific thread
void my_http_worker (void * arg)
{
ngx_http_request_t * r ;
ngx_event_t * ev ;
while (1)
{
my_recvmsg (myqueue,r) ;
// processing the request
// ...
// wake up my_http_handler
ngx_post_event (ev, (ngx_event_t * *) & ngx_posted_events) ;
}
}
But I don't know how to fill the ngx_event_t (in particular the
handlers) in order to call again my_http_handler on Nginx's context.
I believe it's possible to do so from what I've seen, but Nginx's code
is not so easy to enter on (it's not a critic).
Sorry for this (first) long message but I think it would be nice to be
able to develop clean and non blocking modules for Nginx.
BTW forgive my English, I'm French ;-)
Hi there,
is it planned to add digest auth at some time ? It's not that basic
auth is not useful, but it's pretty weak on replay attacks. Nowadays,
every common browser supports digest auth so it would be really a
plus.
I'm also interested if it could support internal urls for the internal
password file, like X-Accel-Redirect does. It would be really useful
to delegate authentication to a third-party web application in a
multi-application setup.
--
Cheers,
zimbatm
I am trying to use a test for the existence of a file to return a error
page with a 503 Temporarily Unavailable response code. My configuration
is below. The problem is that it does not work. I can see the custom
error page, but the HTTP status code is 200, not the desired 503.
If I change the if directive to this:
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html; # No last
return 503;
}
I start getting a 503 HTTP status code, but the content is not my custom
error page, but rather the default 503 response compiled into the nginx
server.
Am I doing something terribly wrong? I would really like to see my
custom page with a real 503 HTTP status code.
Thanks for any help,
Douglas A. Seifert
nginx.conf:
--------------------------------------------------
# user and group to run as
#user www www;
# number of nginx workers
worker_processes 6;
# pid of nginx master process
pid /usr/local/www/nginx.pid;
# Number of worker connections. 1024 is a good default
events {
worker_connections 1024;
}
# start the http module where we config http access.
http {
# pull in mime-types. You can break out your config
# into as many include's as you want to make it cleaner
include /usr/local/nginx/conf/mime.types;
# set a default type for the rare situation that
# nothing matches from the mimie-type include
default_type application/octet-stream;
# configure log format
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent "$http_referer"
'
'"$http_user_agent" "$http_x_forwarded_for"';
# main access log
access_log /usr/local/www/log/nginx_access.log main;
# main error log
error_log /usr/local/www/log/nginx_error.log debug;
# no sendfile on OSX
sendfile on;
# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
server {
# port to listen on. Can also be set to an IP:PORT
listen *:8080;
# Set the max size for file uploads to 50Mb
client_max_body_size 50M;
# sets the domain[s] that this vhost server requests for
server_name .foo.com *;
# doc root
root /usr/local/www/test;
# vhost specific access log
access_log /usr/local/www/log/nginx.vhost.access.log main;
# this rewrites all the requests to the maintenance.html
# page if it exists in the doc root. This is for capistrano's
# disable web task
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
return 503;
}
location / {
root /usr/local/www/test;
}
error_page 500 502 504 /500.html;
error_page 503 /503.html;
}
}
-----------------------------------------------------------------
Hi guys,
I have a problem while using nginx to proxy anytermd. anytermd is a simple
web server which always outputs chunked
data. The following is the data that nginx gave to me:
HTTP/1.1 200 OK
Server: nginx/0.5.36
Date: Fri, 09 May 2008 00:30:37 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Transfer-Encoding: chunked
75f
753
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
......
0
0
I saw the doc said that nginx talks http/1.0 to the backend server.How can I
let the nginx outputing the original data?
>You can also use regular expressions for a bit more flexibility. This
>way you can explicitly accept only the request methods you allow and
>return the error code of your choosing.
>## Only allow GET and HEAD request methods
> if ($request_method !~ ^(GET|HEAD)$ ) {
> return 444;
> }
Hello - I am using the latest nginx 6. When I try to do as you say above I am getting the error in the nginx error file: unknown directive "if" in xyz.log
I am using your exact block as above and from your web page, like this:
if ($request_method !~ ^(GET|HEAD)$ ) {
return 444;
}
I have tried this within the main server directive as well as from within location directives, but always get this error. Obviously I am missing something? Thanks.
I've got an app that I upload CSV files to. So far it's worked
flawlessly until yesterday. The CSV files have gotten progressively
larger and yesterday they broke 10Mb. At this point Nginx logs an error
that says:
[error] 6610#0: *67 client intended to send too large body: 11226223
bytes
I've got this in my nginx.conf:
client_max_body_size 150m;
What other parameters might affect this?
I tested with 0.6.29 and 0.6.31.
Cliff