[ Index ]

PHP Cross Reference of phpBB-3.2.11-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          return 301 http://www.myforums.com$request_uri;
  53      }
  54  
  55      # The actual board domain.
  56      server {
  57          #listen 80;
  58          server_name www.myforums.com;
  59  
  60          root /path/to/phpbb;
  61  
  62          location / {
  63              # phpBB uses index.htm
  64              index index.php index.html index.htm;
  65              try_files $uri $uri/ @rewriteapp;
  66          }
  67  
  68          location @rewriteapp {
  69              rewrite ^(.*)$ /app.php/$1 last;
  70          }
  71  
  72          # Deny access to internal phpbb files.
  73          location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
  74              deny all;
  75              # deny was ignored before 0.8.40 for connections over IPv6.
  76              # Use internal directive to prohibit access on older versions.
  77              internal;
  78          }
  79  
  80          # Pass the php scripts to fastcgi server specified in upstream declaration.
  81          location ~ \.php(/|$) {
  82              # Unmodified fastcgi_params from nginx distribution.
  83              include fastcgi_params;
  84              # Necessary for php.
  85              fastcgi_split_path_info ^(.+\.php)(/.*)$;
  86              fastcgi_param PATH_INFO $fastcgi_path_info;
  87              fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  88              fastcgi_param DOCUMENT_ROOT $realpath_root;
  89              try_files $uri $uri/ /app.php$is_args$args;
  90              fastcgi_pass php;
  91          }
  92  
  93          # Correctly pass scripts for installer
  94          location /install/ {
  95              # phpBB uses index.htm
  96              try_files $uri $uri/ @rewrite_installapp =404;
  97  
  98              # Pass the php scripts to fastcgi server specified in upstream declaration.
  99              location ~ \.php(/|$) {
 100                  # Unmodified fastcgi_params from nginx distribution.
 101                  include fastcgi_params;
 102                  # Necessary for php.
 103                  fastcgi_split_path_info ^(.+\.php)(/.*)$;
 104                  fastcgi_param PATH_INFO $fastcgi_path_info;
 105                  fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
 106                  fastcgi_param DOCUMENT_ROOT $realpath_root;
 107                  try_files $uri $uri/ /install/app.php$is_args$args =404;
 108                  fastcgi_pass php;
 109              }
 110          }
 111  
 112          location @rewrite_installapp {
 113              rewrite ^(.*)$ /install/app.php/$1 last;
 114          }
 115  
 116          # Deny access to version control system directories.
 117          location ~ /\.svn|/\.git {
 118              deny all;
 119              internal;
 120          }
 121      }
 122  
 123      # If running php as fastcgi, specify php upstream.
 124      upstream php {
 125          server unix:/tmp/php.sock;
 126      }
 127  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1