docs/nginx.sample.conf
changeset 0 ceef6d64c21d
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/docs/nginx.sample.conf	Wed Mar 07 16:41:10 2012 +0400
     1.3 @@ -0,0 +1,89 @@
     1.4 +# Sample nginx configuration file for phpBB.
     1.5 +# Global settings have been removed, copy them
     1.6 +# from your system's nginx.conf.
     1.7 +# Tested with nginx 0.8.35.
     1.8 +
     1.9 +http {
    1.10 +    # Compression - requires gzip and gzip static modules.
    1.11 +    gzip on;
    1.12 +    gzip_static on;
    1.13 +    gzip_vary on;
    1.14 +    gzip_http_version 1.1;
    1.15 +    gzip_min_length 700;
    1.16 +    
    1.17 +    # Compression levels over 6 do not give an appreciable improvement
    1.18 +    # in compression ratio, but take more resources.
    1.19 +    gzip_comp_level 6;
    1.20 +    
    1.21 +    # IE 6 and lower do not support gzip with Vary correctly.
    1.22 +    gzip_disable "msie6";
    1.23 +    # Before nginx 0.7.63:
    1.24 +    #gzip_disable "MSIE [1-6]\.";
    1.25 +
    1.26 +    # Catch-all server for requests to invalid hosts.
    1.27 +    # Also catches vulnerability scanners probing IP addresses.
    1.28 +    server {
    1.29 +        # default specifies that this block is to be used when
    1.30 +        # no other block matches.
    1.31 +        listen 80 default;
    1.32 +
    1.33 +        server_name bogus;
    1.34 +        return 444;
    1.35 +        root /var/empty;
    1.36 +    }
    1.37 +
    1.38 +    # If you have domains with and without www prefix,
    1.39 +    # redirect one to the other.
    1.40 +    server {
    1.41 +        # Default port is 80.
    1.42 +        #listen 80;
    1.43 +
    1.44 +        server_name myforums.com;
    1.45 +
    1.46 +        # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
    1.47 +        rewrite ^ http://www.myforums.com$request_uri permanent;
    1.48 +        # Equivalent to:
    1.49 +        #rewrite ^(.*)$ http://www.myforums.com$1 permanent;
    1.50 +    }
    1.51 +
    1.52 +    # The actual board domain.
    1.53 +    server {
    1.54 +        #listen 80;
    1.55 +        server_name www.myforums.com;
    1.56 +
    1.57 +        root /path/to/phpbb;
    1.58 +
    1.59 +        location / {
    1.60 +            # phpbb uses index.htm
    1.61 +            index index.php index.html index.htm;
    1.62 +        }
    1.63 +
    1.64 +        # Deny access to internal phpbb files.
    1.65 +        location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
    1.66 +            deny all;
    1.67 +            # deny was ignored before 0.8.40 for connections over IPv6.
    1.68 +            # Use internal directive to prohibit access on older versions.
    1.69 +            internal;
    1.70 +        }
    1.71 +
    1.72 +        # Pass the php scripts to fastcgi server specified in upstream declaration.
    1.73 +        location ~ \.php$ {
    1.74 +            fastcgi_pass php;
    1.75 +            # Necessary for php.
    1.76 +            fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    1.77 +            # Unmodified fastcgi_params from nginx distribution.
    1.78 +            include fastcgi_params;
    1.79 +        }
    1.80 +
    1.81 +        # Deny access to version control system directories.
    1.82 +        location ~ /\.svn|/\.git {
    1.83 +            deny all;
    1.84 +            internal;
    1.85 +        }
    1.86 +    }
    1.87 +
    1.88 +    # If running php as fastcgi, specify php upstream.
    1.89 +    upstream php {
    1.90 +        server unix:/tmp/php.sock;
    1.91 +    }
    1.92 +}