mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/10069] Improvements to sample nginx configuration.
Most of these were contributed by burningbunny: https://github.com/burningbunny PHPBB3-10069
This commit is contained in:
parent
f08cbc73de
commit
b343920071
1 changed files with 25 additions and 8 deletions
|
@ -10,14 +10,23 @@ http {
|
|||
gzip_vary on;
|
||||
gzip_http_version 1.1;
|
||||
gzip_min_length 700;
|
||||
|
||||
# Compression levels over 6 do not give an appreciable improvement
|
||||
# in compression ratio, but take more resources.
|
||||
gzip_comp_level 6;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
# IE 6 and lower do not support gzip with Vary correctly.
|
||||
gzip_disable "msie6";
|
||||
# Before nginx 0.7.63:
|
||||
#gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
# Catch-all server for requests to invalid hosts.
|
||||
# Also catches vulnerability scanners probing IP addresses.
|
||||
# Should be first.
|
||||
server {
|
||||
listen 80;
|
||||
# default specifies that this block is to be used when
|
||||
# no other block matches.
|
||||
listen 80 default;
|
||||
|
||||
server_name bogus;
|
||||
return 444;
|
||||
root /var/empty;
|
||||
|
@ -26,14 +35,20 @@ http {
|
|||
# If you have domains with and without www prefix,
|
||||
# redirect one to the other.
|
||||
server {
|
||||
listen 80;
|
||||
# Default port is 80.
|
||||
#listen 80;
|
||||
|
||||
server_name myforums.com;
|
||||
rewrite ^(.*)$ http://www.myforums.com$1 permanent;
|
||||
|
||||
# A trick from http://wiki.nginx.org/Pitfalls#Taxing_Rewrites:
|
||||
rewrite ^ http://www.myforums.com$request_uri permanent;
|
||||
# Equivalent to:
|
||||
#rewrite ^(.*)$ http://www.myforums.com$1 permanent;
|
||||
}
|
||||
|
||||
# The actual board domain.
|
||||
server {
|
||||
listen 80;
|
||||
#listen 80;
|
||||
server_name www.myforums.com;
|
||||
|
||||
root /path/to/phpbb;
|
||||
|
@ -45,8 +60,10 @@ http {
|
|||
|
||||
# Deny access to internal phpbb files.
|
||||
location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
|
||||
internal;
|
||||
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 fastcgi server specified in upstream declaration.
|
||||
|
@ -60,8 +77,8 @@ http {
|
|||
|
||||
# Deny access to version control system directories.
|
||||
location ~ /\.svn|/\.git {
|
||||
internal;
|
||||
deny all;
|
||||
internal;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue