Skip to content

Instantly share code, notes, and snippets.

@m1m1s1ku
Last active September 2, 2022 01:55
Show Gist options
  • Save m1m1s1ku/934c41fef512ef1924131009c3d330ce to your computer and use it in GitHub Desktop.
Save m1m1s1ku/934c41fef512ef1924131009c3d330ce to your computer and use it in GitHub Desktop.
Nginx config VHost PhpBB 8.1 (Debian 11 Bullseye)
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name _;
ssl_certificate /etc/nginx/ssl/phpbb.local.crt;
ssl_certificate_key /etc/nginx/ssl/phpbb.local.key;
root /var/www/phpbb;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ @rewriteapp;
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
internal;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /install/app.php$is_args$args =404;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
location ~ /\.svn|/\.git {
deny all;
internal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment