-
-
Save staticfox/e58b08cd1595afb5d3245ed140f5b343 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Gist is nginx.conf just so github will show | |
# the pretty colors | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name my_forum; | |
return 301 https://my_forum$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
listen [::]:443 ssl; | |
root /srv/webroot/public_html; | |
index index.html index.htm index.php; | |
server_name my_forum; | |
location /forums/ { | |
index index.php index.html index.htm; | |
try_files $uri $uri/ @forum_rewriteapp; | |
# Deny access to internal phpbb files. | |
location ~ /forums/(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { | |
deny all; | |
# deny was ignored before 0.8.40 for connections over IPv6. | |
# Use internal directive to prohibit access on older versions. | |
internal; | |
} | |
# Pass the php scripts to php-fpm, this is modified heavily | |
location ~ \.php(/|$) { | |
# Unmodified fastcgi_params from nginx distribution. | |
include fastcgi_params; | |
# Necessary for php. | |
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/ /forums/app.php$is_args$args; | |
fastcgi_pass php; | |
} | |
# Correctly pass scripts for installer | |
location /forums/install/ { | |
# phpBB uses index.htm | |
try_files $uri $uri/ @forum_rewrite_installapp; | |
# Pass the php scripts to php-fpm, this is modified heavily | |
location ~ \.php(/|$) { | |
# regex to split $uri to $fastcgi_script_name and $fastcgi_path | |
# Unmodified fastcgi_params from nginx distribution. | |
include fastcgi_params; | |
# Necessary for php. | |
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/ /forums/install/app.php$is_args$args; | |
fastcgi_pass php; | |
} | |
} | |
} | |
# Forum rewrite blocks | |
location @forum_rewriteapp { | |
rewrite ^(.*)$ /forums/app.php/$1 last; | |
} | |
location @forum_rewrite_installapp { | |
rewrite ^(.*)$ /forums/install/app.php/$1 last; | |
} | |
# Deny access to version control system directories. | |
location ~ /\.svn|/\.git { | |
deny all; | |
internal; | |
} | |
access_log /srv/webroot/logs/access.log combined; | |
error_log /srv/webroot/logs/error.log; | |
## SSL cert/ciphers ommited for this gist | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment