Change nginx conf
This commit is contained in:
@@ -1,3 +1,52 @@
|
|||||||
|
# server {
|
||||||
|
# listen 80 default_server;
|
||||||
|
# listen [::]:80 default_server;
|
||||||
|
# server_name _;
|
||||||
|
# server_tokens off;
|
||||||
|
#
|
||||||
|
# root /app/public;
|
||||||
|
# index index.php;
|
||||||
|
#
|
||||||
|
# location / {
|
||||||
|
# try_files $uri $uri.php $uri/ /index.php$is_args$args;
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# location ~ \.php$ {
|
||||||
|
# include fastcgi_params;
|
||||||
|
# fastcgi_pass php:9000;
|
||||||
|
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
|
||||||
|
## existing .htaccess
|
||||||
|
|
||||||
|
# # mod_rewrite starts here
|
||||||
|
# RewriteEngine on
|
||||||
|
#
|
||||||
|
# # Prevent directory listings
|
||||||
|
# Options All -Indexes
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# # does not apply to existing directories, meaning that if the folder exists on the server then don't change anything and don't run the Rule!
|
||||||
|
#
|
||||||
|
# RewriteCond %{REQEUSTED_FILENAME} !-d
|
||||||
|
# RewriteCond %{REQUEST_FILENAME}\.html -f
|
||||||
|
# RewriteRule ^(.*)$ $1.html [NC,L]
|
||||||
|
#
|
||||||
|
# RewriteCond %{REQUEST_FILENAME}\.php -f
|
||||||
|
# RewriteRule ^(.*)$ $1.php [NC,L]
|
||||||
|
#
|
||||||
|
# ErrorDocument 404 /404
|
||||||
|
# ErrorDocument 403 /403
|
||||||
|
#
|
||||||
|
# <Files template.php>
|
||||||
|
# order allow,deny
|
||||||
|
# deny from all
|
||||||
|
# </Files>
|
||||||
|
|
||||||
|
|
||||||
|
# write a nginx config combining the above .htaccess and the existing nginx config
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
listen [::]:80 default_server;
|
||||||
@@ -16,4 +65,27 @@ server {
|
|||||||
fastcgi_pass php:9000;
|
fastcgi_pass php:9000;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~ \.html$ {
|
||||||
|
try_files $uri $uri.html $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri $uri.php $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 404 /404;
|
||||||
|
error_page 403 /403;
|
||||||
|
|
||||||
|
location = /404 {
|
||||||
|
root /app/public;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /403 {
|
||||||
|
root /app/public;
|
||||||
|
}
|
||||||
|
|
||||||
|
location = /template.php {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user