From db7b51e00891e5a67e8be7baa2f3385f74174215 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sat, 7 Dec 2024 20:31:39 +0100 Subject: Move webserver config files to "core" directory ... and add `/.htaccess` to the ignore list in `.gitignore`. If one wants to configure Apache by using the good old `.htaccess` file, all they have to do is copying the `core/ws-apache.conf` to `.htaccess`. Because of the `.gitignore`, Git will not list the `.htaccess` file as changed anymore if it contains additional configuration parameters. --- .gitignore | 1 + .ht-nginx | 41 ----------------------------------------- .htaccess | 48 ------------------------------------------------ core/ws-apache.conf | 42 ++++++++++++++++++++++++++++++++++++++++++ core/ws-nginx.conf | 41 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+), 89 deletions(-) delete mode 100644 .ht-nginx delete mode 100644 .htaccess create mode 100644 core/ws-apache.conf create mode 100644 core/ws-nginx.conf diff --git a/.gitignore b/.gitignore index b9c9e28..f21ed02 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /.idea/ +/.htaccess /static/ *.js.map *.css.map diff --git a/.ht-nginx b/.ht-nginx deleted file mode 100644 index 45bda6a..0000000 --- a/.ht-nginx +++ /dev/null @@ -1,41 +0,0 @@ -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# nginx configuration [Thomas Lange ] # -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# # -# This file contains the configuration from the Apaches .htaccess file written # -# for the nginx high performance web server. Put the content of this file into # -# the "server {}" block of your nginx virtual host configuration file. If your # -# blog is installed in a sub directory, you might need to adjust this rules! # -# # -# How to setup PHP and passing requests via FastCGI to PHP-FPM is your job. If # -# you encounter a "403 Forbidden" error on the home page, please make sure you # -# have configured your nginx virtual host to look for an index.php file: # -# # -# index index.php [...]; # -# # -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# - -#=============================================================================== -# Error pages -#=============================================================================== -error_page 403 /403.php; -error_page 404 /404.php; - -#=============================================================================== -# Forbidden directories -#=============================================================================== -location ~ ^/(.git|core|theme/([^/]+)/(html|lang))/ { - return 403; -} - -#=============================================================================== -# Pass requests to index.php -#=============================================================================== -location / { - try_files $uri $uri/ /index.php?$args; -} - -#=============================================================================== -# Redirect from old to new global static dir -#=============================================================================== -#rewrite ^/rsrc/(.*)$ /static/$1 permanent; diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 55c32d3..0000000 --- a/.htaccess +++ /dev/null @@ -1,48 +0,0 @@ -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# Apache configuration [Thomas Lange ] # -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# -# # -# This file contains the configuration rules for the Apache HTTP server. It is # -# recommended to include these rules directly into the Apache configuration! # -# # -# Additionally, it's recommended to ensure that the AllowOverride directive is # -# disabled if these rules are included in the Apache configuration. Otherwise, # -# the Apache HTTP server is checking for .htaccess files on every request. # -# # -# AllowOverride None # -# # -# NOTICE: If you decide to include these rules directly into the Apache config # -# and want to set AllowOverride to something other than "None", it might cause # -# trouble with this .htaccess file which might contain rules that are not per- # -# mitted by your custom AllowOverride setting in the server config. You should # -# rename (or delete) this file to prevent Apache from parsing it in that case! # -# # -#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# - -#=============================================================================== -# Error pages -#=============================================================================== -ErrorDocument 403 /403.php -ErrorDocument 404 /404.php - -#=============================================================================== -# Enable RewriteEngine -#=============================================================================== -RewriteEngine On - -#=============================================================================== -# Forbidden directories -#=============================================================================== -RewriteRule ^(.git|core|theme/([^/]+)/(html|lang))/ - [F] - -#=============================================================================== -# Pass requests to index.php -#=============================================================================== -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule . index.php [L] - -#=============================================================================== -# Redirect from old to new global static dir -#=============================================================================== -#Redirect 301 /rsrc/ /static/ diff --git a/core/ws-apache.conf b/core/ws-apache.conf new file mode 100644 index 0000000..e7b0e10 --- /dev/null +++ b/core/ws-apache.conf @@ -0,0 +1,42 @@ +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# Apache configuration [Thomas Lange ] # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# # +# This file contains the configuration rules for the Apache HTTP server. It is # +# recommended to include these rules directly into the Apache configuration! # +# # +# Additionally, it's recommended to ensure that the AllowOverride directive is # +# disabled if these rules are included in the Apache configuration. Otherwise, # +# the Apache HTTP server is checking for .htaccess files on every request. # +# # +# AllowOverride None # +# # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# + +#=============================================================================== +# Error pages +#=============================================================================== +ErrorDocument 403 /403.php +ErrorDocument 404 /404.php + +#=============================================================================== +# Enable RewriteEngine +#=============================================================================== +RewriteEngine On + +#=============================================================================== +# Forbidden directories +#=============================================================================== +RewriteRule ^(.git|core|theme/([^/]+)/(html|lang))/ - [F] + +#=============================================================================== +# Pass requests to index.php +#=============================================================================== +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule . index.php [L] + +#=============================================================================== +# Redirect from old to new global static dir +#=============================================================================== +#Redirect 301 /rsrc/ /static/ diff --git a/core/ws-nginx.conf b/core/ws-nginx.conf new file mode 100644 index 0000000..45bda6a --- /dev/null +++ b/core/ws-nginx.conf @@ -0,0 +1,41 @@ +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# nginx configuration [Thomas Lange ] # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# +# # +# This file contains the configuration from the Apaches .htaccess file written # +# for the nginx high performance web server. Put the content of this file into # +# the "server {}" block of your nginx virtual host configuration file. If your # +# blog is installed in a sub directory, you might need to adjust this rules! # +# # +# How to setup PHP and passing requests via FastCGI to PHP-FPM is your job. If # +# you encounter a "403 Forbidden" error on the home page, please make sure you # +# have configured your nginx virtual host to look for an index.php file: # +# # +# index index.php [...]; # +# # +#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%# + +#=============================================================================== +# Error pages +#=============================================================================== +error_page 403 /403.php; +error_page 404 /404.php; + +#=============================================================================== +# Forbidden directories +#=============================================================================== +location ~ ^/(.git|core|theme/([^/]+)/(html|lang))/ { + return 403; +} + +#=============================================================================== +# Pass requests to index.php +#=============================================================================== +location / { + try_files $uri $uri/ /index.php?$args; +} + +#=============================================================================== +# Redirect from old to new global static dir +#=============================================================================== +#rewrite ^/rsrc/(.*)$ /static/$1 permanent; -- cgit v1.2.3