user                            www-data;
worker_processes        4;

error_log       /var/log/httpd/nginx-error.log notice;

pid                     /var/run/nginx.pid;


events {
        worker_connections      1024;
}

http {
        include                 mime.types;
        default_type    application/octet-stream;

        log_format              main    '$remote_addr $host - $remote_user [$time_local] "$request" '
                                                        '$status $body_bytes_sent "$http_referer" '
                                                        '"$http_user_agent" "$http_x_forwarded_for" "$gzip_ratio"';

        access_log              /var/log/httpd/nginx-access.log main;

        limit_zone arbeit $binary_remote_addr 1m;

        server_tokens                           off;

        reset_timedout_connection       on;
        sendfile                                        on;
        tcp_nopush                                      on;
        tcp_nodelay                                     on;

        open_file_cache                         max=1000 inactive=60s;
        open_file_cache_valid           90s;
        open_file_cache_min_uses        2;
        open_file_cache_errors          on;

        client_max_body_size            20m;
        client_body_buffer_size         128k;

        keepalive_timeout                       75;

        ssl_session_cache                       shared:SSL:10m;
        ssl_session_timeout                     10m;
        ssl_protocols                           SSLv3 TLSv1;
        ssl_ciphers                                     HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers       on;

        gzip                                            on;
        gzip_min_length                         1100;
        gzip_comp_level                         6;
        gzip_proxied                            any;
        gzip_buffers                            16 8k;
        gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml image/bmp;
        gzip_vary                                       on;
        gzip_disable                            "msie6";

        add_header X-Frame-Options sameorigin;

        geoip_country   /usr/local/share/GeoIP/GeoIP.dat;
        geoip_city              /usr/local/share/GeoIP/GeoLiteCity.dat;

        server {
                listen          192.168.10.80:80 default_server accept_filter=httpready;
                server_name     web1.vps

                allow   all;

                rewrite ^(.*) https://$host$1 permanent;

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

        server {
                listen          192.168.10.80:443 default_server accept_filter=httpready;
                server_name     web1.vps

                allow    all;

                ssl                                             on;
                ssl_certificate                 /usr/local/etc/ssl/httpd/crt/vps.crt;
                ssl_certificate_key             /usr/local/etc/ssl/httpd/key/server.key;

                location / {
                        root    /usr/local/www/nginx;
                        index   index.html index.htm index.php;
                }

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

                location = /favicon.ico {
                        log_not_found off;
                        access_log off;
                }

                location = /robots.txt {
                        allow all;
                        log_not_found off;
                        # access_log off;
                }

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

        include /usr/local/etc/nginx/conf.d/*.conf;
        include /usr/local/etc/nginx/sites-enabled/*.conf;
}
