Skip to content

Instantly share code, notes, and snippets.

@lewislarsen
Created July 25, 2021 02:16
Show Gist options
  • Save lewislarsen/377cd58d2102f1f5277425b73610c284 to your computer and use it in GitHub Desktop.
Save lewislarsen/377cd58d2102f1f5277425b73610c284 to your computer and use it in GitHub Desktop.
phpBB nginx config for Ploi
# Ploi Webserver Configuration, do not remove!
include /etc/nginx/ploi/domain.com/before/*;
server {
listen 80;
listen [::]:80;
root /home/ploi/domain.com;
server_name domain.com;
index index.php index.html;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
# Ploi Configuration, do not remove!
include /etc/nginx/ploi/domain.com/server/*;
access_log off;
error_log /var/log/nginx/domain.com-error.log error;
location / {
try_files $uri $uri/ @rewriteapp;
# Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
# change this if you're running a different version of PHP for your site!
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
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;
}
# Deny access to internal phpbb files.
location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
# Correctly pass scripts for installer
location /install/ {
try_files $uri $uri/ @rewrite_installapp =404;
# Pass the php scripts to fastcgi server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
# change this if you're running a different version of PHP for your site!
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
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;
}
}
# rewrite for installation path
location @rewrite_installapp {
rewrite ^(.*)$ /install/app.php/$1 last;
}
# Deny access to version control system directories.
location ~ /\.svn|/\.git {
deny all;
internal;
}
}
# Ploi Webserver Configuration, do not remove!
include /etc/nginx/ploi/domain.com/after/*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment