[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/docs/ -> nginx.sample.conf (source)

   1  # Sample nginx configuration file for phpBB.
   2  # Global settings have been removed, copy them
   3  # from your system's nginx.conf.
   4  # Tested with nginx 0.8.35.
   5  
   6  http {
   7      # Compression - requires gzip and gzip static modules.
   8      gzip on;
   9      gzip_static on;
  10      gzip_vary on;
  11      gzip_http_version 1.1;
  12      gzip_min_length 700;
  13      
  14      # Compression levels over 6 do not give an appreciable improvement
  15      # in compression ratio, but take more resources.
  16      gzip_comp_level 6;
  17      
  18      # IE 6 and lower do not support gzip with Vary correctly.
  19      gzip_disable "msie6";
  20      # Before nginx 0.7.63:
  21      #gzip_disable "MSIE [1-6]\.";
  22  
  23      # Catch-all server for requests to invalid hosts.
  24      # Also catches vulnerability scanners probing IP addresses.
  25      server {
  26          # default specifies that this block is to be used when
  27          # no other block matches.
  28          listen 80 default;
  29  
  30          server_name bogus;
  31          return 444;
  32          root /var/empty;
  33      }
  34  
  35      # If you have domains with and without www prefix,
  36      # redirect one to the other.
  37      server {
  38          # Default port is 80.
  39          #listen 80;
  40  
  41          server_name myforums.com;
  42  
  43          # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
  44          rewrite ^ http://www.myforums.com$request_uri permanent;
  45          # Equivalent to:
  46          #rewrite ^(.*)$ http://www.myforums.com$1 permanent;
  47      }
  48  
  49      # The actual board domain.
  50      server {
  51          #listen 80;
  52          server_name www.myforums.com;
  53  
  54          root /path/to/phpbb;
  55  
  56          location / {
  57              # phpbb uses index.htm
  58              index index.php index.html index.htm;
  59          }
  60  
  61          # Deny access to internal phpbb files.
  62          location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
  63              deny all;
  64              # deny was ignored before 0.8.40 for connections over IPv6.
  65              # Use internal directive to prohibit access on older versions.
  66              internal;
  67          }
  68  
  69          # Pass the php scripts to fastcgi server specified in upstream declaration.
  70          location ~ \.php$ {
  71              fastcgi_pass php;
  72              # Necessary for php.
  73              fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  74              # Unmodified fastcgi_params from nginx distribution.
  75              include fastcgi_params;
  76          }
  77  
  78          # Deny access to version control system directories.
  79          location ~ /\.svn|/\.git {
  80              deny all;
  81              internal;
  82          }
  83      }
  84  
  85      # If running php as fastcgi, specify php upstream.
  86      upstream php {
  87          server unix:/tmp/php.sock;
  88      }
  89  }


Generated: Wed Oct 2 15:03:47 2013 Cross-referenced by PHPXref 0.7.1