[ Index ]

PHP Cross Reference of phpBB-3.2.0-deutsch

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  # If you want to use the X-Accel-Redirect feature,
   7  # add the following to your config.php.
   8  #
   9  #  define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
  10  #
  11  # See http://wiki.nginx.org/XSendfile for the details
  12  # on X-Accel-Redirect.
  13  
  14  http {
  15      # Compression - requires gzip and gzip static modules.
  16      gzip on;
  17      gzip_static on;
  18      gzip_vary on;
  19      gzip_http_version 1.1;
  20      gzip_min_length 700;
  21      
  22      # Compression levels over 6 do not give an appreciable improvement
  23      # in compression ratio, but take more resources.
  24      gzip_comp_level 6;
  25      
  26      # IE 6 and lower do not support gzip with Vary correctly.
  27      gzip_disable "msie6";
  28      # Before nginx 0.7.63:
  29      #gzip_disable "MSIE [1-6]\.";
  30  
  31      # Catch-all server for requests to invalid hosts.
  32      # Also catches vulnerability scanners probing IP addresses.
  33      server {
  34          # default specifies that this block is to be used when
  35          # no other block matches.
  36          listen 80 default;
  37  
  38          server_name bogus;
  39          return 444;
  40          root /var/empty;
  41      }
  42  
  43      # If you have domains with and without www prefix,
  44      # redirect one to the other.
  45      server {
  46          # Default port is 80.
  47          #listen 80;
  48  
  49          server_name myforums.com;
  50  
  51          # A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
  52          rewrite ^ http://www.myforums.com$request_uri permanent;
  53          # Equivalent to:
  54          #rewrite ^(.*)$ http://www.myforums.com$1 permanent;
  55      }
  56  
  57      # The actual board domain.
  58      server {
  59          #listen 80;
  60          server_name www.myforums.com;
  61  
  62          root /path/to/phpbb;
  63  
  64          location / {
  65              # phpBB uses index.htm
  66              index index.php index.html index.htm;
  67              try_files $uri $uri/ @rewriteapp;
  68          }
  69  
  70          location @rewriteapp {
  71              rewrite ^(.*)$ /app.php/$1 last;
  72          }
  73  
  74          # Deny access to internal phpbb files.
  75          location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
  76              deny all;
  77              # deny was ignored before 0.8.40 for connections over IPv6.
  78              # Use internal directive to prohibit access on older versions.
  79              internal;
  80          }
  81  
  82          # Pass the php scripts to fastcgi server specified in upstream declaration.
  83          location ~ \.php(/|$) {
  84              # Unmodified fastcgi_params from nginx distribution.
  85              include fastcgi_params;
  86              # Necessary for php.
  87              fastcgi_split_path_info ^(.+\.php)(/.*)$;
  88              fastcgi_param PATH_INFO $fastcgi_path_info;
  89              fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  90              fastcgi_param DOCUMENT_ROOT $realpath_root;
  91              try_files $uri $uri/ /app.php$is_args$args;
  92              fastcgi_pass php;
  93          }
  94  
  95          # Correctly pass scripts for installer
  96          location /install/ {
  97              # phpBB uses index.htm
  98              try_files $uri $uri/ @rewrite_installapp;
  99  
 100              # Pass the php scripts to fastcgi server specified in upstream declaration.
 101              location ~ \.php(/|$) {
 102                  # Unmodified fastcgi_params from nginx distribution.
 103                  include fastcgi_params;
 104                  # Necessary for php.
 105                  fastcgi_split_path_info ^(.+\.php)(/.*)$;
 106                  fastcgi_param PATH_INFO $fastcgi_path_info;
 107                  fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
 108                  fastcgi_param DOCUMENT_ROOT $realpath_root;
 109                  try_files $uri $uri/ /install/app.php$is_args$args;
 110                  fastcgi_pass php;
 111              }
 112          }
 113  
 114          location @rewrite_installapp {
 115              rewrite ^(.*)$ /install/app.php/$1 last;
 116          }
 117  
 118          # Deny access to version control system directories.
 119          location ~ /\.svn|/\.git {
 120              deny all;
 121              internal;
 122          }
 123      }
 124  
 125      # If running php as fastcgi, specify php upstream.
 126      upstream php {
 127          server unix:/tmp/php.sock;
 128      }
 129  }


Generated: Sun Feb 19 19:47:08 2017 Cross-referenced by PHPXref 0.7.1