Mixed Virtualhosts and IP hosts

mike mike503 at gmail.com
Sun Aug 31 10:58:39 MSD 2008


On 8/30/08, Igor Sysoev <is at rambler-co.ru> wrote:

> I never tried several http {} blocks, and I'm not sure that it will
> work correctly.

really? works fine from my perspective - here's my config. seems to work great.

i thought that was the whole point, is you can have multiple services
as needed (http, imap or whatever, etc) - i guess i'd take any
optimization pointers, i'm always interested in simplifying
configurations and optimization!



user www-data www-data;
worker_processes 2;
worker_cpu_affinity 0001 0010;
worker_rlimit_nofile 131072;
working_directory /var/run;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
        worker_connections 1024;
}

http {
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        access_log off;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        ignore_invalid_headers on;
        client_max_body_size 251m;
        client_header_buffer_size 8k;
        client_body_buffer_size 256k;
        large_client_header_buffers 16 8k;
        keepalive_timeout 30;
        server_tokens off;
        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_FILENAME $document_root$fastcgi_script_name;
        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 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 $http_host;
        fastcgi_param REDIRECT_STATUS 200;
        fastcgi_ignore_client_abort on;
        fastcgi_buffers 16 16k;
        fastcgi_index index.php;
        fastcgi_intercept_errors on;

        gzip on;
        gzip_static on;
        gzip_proxied any;
        gzip_min_length 1100;
        gzip_buffers 16 8k;
        #gzip_http_version 1.0;
        gzip_comp_level 4;
        gzip_types text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;
        gzip_disable "MSIE [1-6]\.";
        gzip_vary on;

        server_names_hash_max_size 4096;
        server_names_hash_bucket_size 128;

        server {
                listen 80;
                all my server stuff here
                tons of server blocks
        }
}

http {
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        sendfile on;
        keepalive_timeout 0;
        tcp_nodelay on;
        client_max_body_size 251m;
        client_body_temp_path /var/mogdata/.tmp;
        server_tokens off;
        server {
                access_log off;
                listen 7500;
                server_name localhost;
                charset utf-8;
                location / {
                        root /var/mogdata/;
                        dav_methods put delete mkcol copy move;
                        dav_access user:rw group:rw all:r;
                        # not sure if this is needed
                        create_full_put_path on;
                }
                # these are not right
                error_page 500 502 503 504 /50x.html;
                location /50x.html {
                        root html;
                }
        }
}





More information about the nginx mailing list