[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

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

   1  # Sample nginx configuration file for phpBB.
   2  # Tested with:
   3  # - nginx 0.8.35
   4  # - nginx 1.17.7 (mainline)
   5  #
   6  # Filename: /etc/nginx/sites-available/example.com.conf
   7  #
   8  # Replace example.com with your own domain name.
   9  
  10  # If you want to use the X-Accel-Redirect feature,
  11  # add the following to your config.php.
  12  #
  13  #  define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
  14  #
  15  # See http://wiki.nginx.org/XSendfile for the details
  16  # on X-Accel-Redirect.
  17  
  18  # Sample FastCGI server configuration.
  19  # Filename: /etc/nginx/conf.d/php.conf
  20  #
  21  #  upstream php {
  22  #      server unix:/run/php-fpm/php-fpm.sock;
  23  #  }
  24  
  25  # Remove www domain prefix.
  26  server {
  27      listen 80;
  28      # IPv6
  29      listen [::]:80;
  30  
  31      # Remove www
  32      server_name www.example.com;
  33      return 301 $scheme://example.com$request_uri;
  34  }
  35  
  36  # Board configuration.
  37  server {
  38      listen 80;
  39      # IPv6
  40      listen [::]:80;
  41      server_name example.com;
  42      root /path/to/phpbb;
  43  
  44      # phpBB uses index.htm
  45      index index.php index.html index.htm;
  46  
  47      # Loggers
  48      error_log /var/log/nginx/example.com.error.log warn;
  49      access_log /var/log/nginx/example.com.access.log;
  50  
  51      location / {
  52          try_files $uri $uri/ @rewriteapp;
  53  
  54          # Pass the php scripts to FastCGI server specified in upstream declaration.
  55          location ~ \.php(/|$) {
  56              include fastcgi.conf;
  57              fastcgi_split_path_info ^(.+\.php)(/.*)$;
  58              fastcgi_param PATH_INFO $fastcgi_path_info;
  59              fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
  60              fastcgi_param DOCUMENT_ROOT $realpath_root;
  61              try_files $uri $uri/ /app.php$is_args$args;
  62              fastcgi_pass php;
  63          }
  64  
  65          # Deny access to internal phpbb files.
  66          location ~ /(config|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
  67              deny all;
  68              # deny was ignored before 0.8.40 for connections over IPv6.
  69              # Use internal directive to prohibit access on older versions.
  70              internal;
  71          }
  72      }
  73  
  74      location @rewriteapp {
  75          rewrite ^(.*)$ /app.php/$1 last;
  76      }
  77  
  78      # Correctly pass scripts for installer
  79      location /install/ {
  80          try_files $uri $uri/ @rewrite_installapp =404;
  81  
  82          # Pass the php scripts to fastcgi server specified in upstream declaration.
  83          location ~ \.php(/|$) {
  84              include fastcgi.conf;
  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/ /install/app.php$is_args$args =404;
  90              fastcgi_pass php;
  91          }
  92      }
  93  
  94      location @rewrite_installapp {
  95          rewrite ^(.*)$ /install/app.php/$1 last;
  96      }
  97  
  98      # Deny access to version control system directories.
  99      location ~ /\.svn|/\.git {
 100          deny all;
 101          internal;
 102      }
 103  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1