This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98da23b
commit ebff70b
Showing
3 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
server { | ||
listen 80; | ||
server_name %%DOMAIN%% | ||
return 301 https://%%DOMAIN%%/request_uri/; | ||
} | ||
|
||
server { | ||
listen 443 ssl http2; | ||
|
||
ssl_certificate /path/to/ssl/certicate.crt; | ||
ssl_certificate_key /path/to/ssl/certicate.key; | ||
|
||
ssl_stapling on; | ||
ssl_stapling_verify on; | ||
|
||
set $root_path '%%SOURCE_PATH%%'; | ||
server_name %%DOMAIN%%; | ||
|
||
index index.html index.htm index.php; | ||
root $root_path; | ||
try_files $uri $uri/ @rewrite; | ||
sendfile off; | ||
|
||
include /etc/nginx/mime.types; | ||
|
||
# Block access to sensitive files and return 404 to make it indistinguishable from a missing file | ||
location ~* .(ini|sh|inc|bak|twig|sql)$ { | ||
return 404; | ||
} | ||
|
||
# Block access to hidden files except .well-known | ||
location ~ /\.(?!well-known\/) { | ||
return 404; | ||
} | ||
|
||
# Disable PHP execution in /uploads | ||
location ~* /uploads/.*\.php$ { | ||
return 404; | ||
} | ||
|
||
# Deny access to /data | ||
location ~* /data/ { | ||
return 404; | ||
} | ||
|
||
location @rewrite { | ||
rewrite ^/page/(.*)$ /index.php?_url=/custompages/$1; | ||
rewrite ^/(.*)$ /index.php?_url=/$1; | ||
} | ||
|
||
location ~ \.php { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
|
||
# fastcgi_pass need to be changed according your server setup: | ||
# phpx.x is your server setup | ||
# examples: /var/run/phpx.x-fpm.sock, /var/run/php/phpx.x-fpm.sock or /run/php/phpx.x-fpm.sock are all valid options | ||
# Or even localhost:port (Default 9000 will work fine) | ||
# Please check your server setup | ||
|
||
fastcgi_pass unix:/run/php/phpx.x-fpm.sock; | ||
|
||
fastcgi_param PATH_INFO $fastcgi_path_info; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_intercept_errors on; | ||
|
||
include fastcgi_params; | ||
} | ||
|
||
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { | ||
root $root_path; | ||
expires off; | ||
} | ||
} |