2022-03-05 23:58:18 +00:00
|
|
|
##
|
|
|
|
# Nginx block configuration template
|
|
|
|
# based on the example created by Olaf Conradi
|
|
|
|
#
|
|
|
|
# The files generated with this template will be added to
|
|
|
|
# /etc/nginx/sites-available & /etc/nginx/sites-enabled (symlink)
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# You should look at the following URL's in order to grasp a solid understanding
|
|
|
|
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
|
|
|
#
|
|
|
|
# http://wiki.nginx.org/Pitfalls
|
|
|
|
# http://wiki.nginx.org/QuickStart
|
|
|
|
# http://wiki.nginx.org/Configuration
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This configuration assumes
|
|
|
|
# You filled the zotserver-config.txt file
|
2022-04-01 01:10:10 +00:00
|
|
|
# Your use a local domain
|
2022-03-05 23:58:18 +00:00
|
|
|
# You have PHP FastCGI Process Manager (php-fpm) running on localhost
|
|
|
|
##
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 80;
|
2022-04-01 01:10:10 +00:00
|
|
|
listen [::]:80
|
2022-03-05 23:58:18 +00:00
|
|
|
server_name SERVER_NAME;
|
|
|
|
|
|
|
|
charset utf-8;
|
|
|
|
root INSTALL_PATH;
|
|
|
|
index index.php;
|
|
|
|
access_log /var/log/nginx/SERVER_LOG;
|
|
|
|
|
|
|
|
#Uncomment the following line to include a standard configuration file
|
|
|
|
#Note that the most specific rule wins and your standard configuration
|
|
|
|
#will therefore *add* to this file, but not override it.
|
|
|
|
#include standard.conf
|
|
|
|
|
|
|
|
# allow uploads up to 20MB in size
|
|
|
|
client_max_body_size 20m;
|
|
|
|
client_body_buffer_size 128k;
|
|
|
|
|
|
|
|
include mime.types;
|
|
|
|
|
|
|
|
# rewrite to front controller as default rule
|
|
|
|
location / {
|
|
|
|
if (!-e $request_filename) {
|
|
|
|
rewrite ^(.*)$ /index.php?req=$1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# make sure webfinger and other well known services aren't blocked
|
|
|
|
# by denying dot files and rewrite request to the front controller
|
|
|
|
location ^~ /.well-known/ {
|
|
|
|
allow all;
|
|
|
|
if (!-e $request_filename) {
|
|
|
|
rewrite ^(.*)$ /index.php?req=$1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# statically serve these file types when possible
|
|
|
|
# otherwise fall back to front controller
|
|
|
|
# allow browser to cache them
|
|
|
|
# added .htm for advanced source code editor library
|
|
|
|
# location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|map|ttf|woff|woff2|svg)$ {
|
|
|
|
# expires 30d;
|
|
|
|
# try_files $uri /index.php?req=$uri&$args;
|
|
|
|
# }
|
|
|
|
# SHOULD WE UNCOMMENT THE ABOVE LINES ?
|
|
|
|
|
|
|
|
# block these file types
|
|
|
|
location ~* \.(tpl|md|tgz|log|out)$ {
|
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
|
|
|
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
|
|
|
# or a unix socket
|
|
|
|
location ~* \.php$ {
|
|
|
|
# IS THE FOLLOWING STILL RELEVANT AS OF AUGUST 2020?
|
|
|
|
# Zero-day exploit defense.
|
|
|
|
# http://forum.nginx.org/read.php?2,88845,page=3
|
|
|
|
# Won't work properly (404 error) if the file is not stored on this
|
|
|
|
# server, which is entirely possible with php-fpm/php-fcgi.
|
|
|
|
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on
|
|
|
|
# another machine. And then cross your fingers that you won't get hacked.
|
|
|
|
try_files $uri =404;
|
|
|
|
|
|
|
|
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
|
|
|
|
|
|
|
# With php5-cgi alone:
|
|
|
|
# fastcgi_pass 127.0.0.1:9000;
|
|
|
|
|
|
|
|
# With php-fpm:
|
|
|
|
fastcgi_pass unix:/var/run/php/php-fpm.sock;
|
|
|
|
|
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_index index.php;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
# include adminer configuration
|
|
|
|
include /etc/nginx/snippets/adminer-nginx.inc;
|
|
|
|
|
|
|
|
# deny access to all dot files
|
|
|
|
location ~ /\. {
|
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
2022-04-01 01:10:10 +00:00
|
|
|
#deny access to store
|
|
|
|
location ~ /store {
|
|
|
|
deny all;
|
|
|
|
}
|
2022-03-05 23:58:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
}
|