indvdum@0: # Sample nginx configuration file for phpBB. indvdum@0: # Global settings have been removed, copy them indvdum@0: # from your system's nginx.conf. indvdum@0: # Tested with nginx 0.8.35. indvdum@0: indvdum@0: http { indvdum@0: # Compression - requires gzip and gzip static modules. indvdum@0: gzip on; indvdum@0: gzip_static on; indvdum@0: gzip_vary on; indvdum@0: gzip_http_version 1.1; indvdum@0: gzip_min_length 700; indvdum@0: indvdum@0: # Compression levels over 6 do not give an appreciable improvement indvdum@0: # in compression ratio, but take more resources. indvdum@0: gzip_comp_level 6; indvdum@0: indvdum@0: # IE 6 and lower do not support gzip with Vary correctly. indvdum@0: gzip_disable "msie6"; indvdum@0: # Before nginx 0.7.63: indvdum@0: #gzip_disable "MSIE [1-6]\."; indvdum@0: indvdum@0: # Catch-all server for requests to invalid hosts. indvdum@0: # Also catches vulnerability scanners probing IP addresses. indvdum@0: server { indvdum@0: # default specifies that this block is to be used when indvdum@0: # no other block matches. indvdum@0: listen 80 default; indvdum@0: indvdum@0: server_name bogus; indvdum@0: return 444; indvdum@0: root /var/empty; indvdum@0: } indvdum@0: indvdum@0: # If you have domains with and without www prefix, indvdum@0: # redirect one to the other. indvdum@0: server { indvdum@0: # Default port is 80. indvdum@0: #listen 80; indvdum@0: indvdum@0: server_name myforums.com; indvdum@0: indvdum@0: # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites: indvdum@0: rewrite ^ http://www.myforums.com$request_uri permanent; indvdum@0: # Equivalent to: indvdum@0: #rewrite ^(.*)$ http://www.myforums.com$1 permanent; indvdum@0: } indvdum@0: indvdum@0: # The actual board domain. indvdum@0: server { indvdum@0: #listen 80; indvdum@0: server_name www.myforums.com; indvdum@0: indvdum@0: root /path/to/phpbb; indvdum@0: indvdum@0: location / { indvdum@0: # phpbb uses index.htm indvdum@0: index index.php index.html index.htm; indvdum@0: } indvdum@0: indvdum@0: # Deny access to internal phpbb files. indvdum@0: location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { indvdum@0: deny all; indvdum@0: # deny was ignored before 0.8.40 for connections over IPv6. indvdum@0: # Use internal directive to prohibit access on older versions. indvdum@0: internal; indvdum@0: } indvdum@0: indvdum@0: # Pass the php scripts to fastcgi server specified in upstream declaration. indvdum@0: location ~ \.php$ { indvdum@0: fastcgi_pass php; indvdum@0: # Necessary for php. indvdum@0: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; indvdum@0: # Unmodified fastcgi_params from nginx distribution. indvdum@0: include fastcgi_params; indvdum@0: } indvdum@0: indvdum@0: # Deny access to version control system directories. indvdum@0: location ~ /\.svn|/\.git { indvdum@0: deny all; indvdum@0: internal; indvdum@0: } indvdum@0: } indvdum@0: indvdum@0: # If running php as fastcgi, specify php upstream. indvdum@0: upstream php { indvdum@0: server unix:/tmp/php.sock; indvdum@0: } indvdum@0: }