add nginx and php-fpm configs

This commit is contained in:
Matthias Quintern 2024-09-02 14:56:56 +02:00
parent 84431ddb85
commit 6ad22741c5
3 changed files with 61 additions and 6 deletions

View File

@ -3,10 +3,10 @@
# Absolute path to the directory containing all image directories as well as the staging directory
# eg: ROOT_DIR = /data/images
# ROOT_DIR =
ROOT_DIR = /rootdir
# The URI at which the ROOT_DIR will be served
ROOT_PATH = images
ROOT_PATH = bildersio
# Path of the directory containing all the files to be sorted, relative to ROOT_DIR
# eg: STAGING_DIR = .sort
@ -14,7 +14,7 @@ STAGING_DIR = .sort
# Absolute path to the directory into which the application files will be installed
# eg: INSTALL_DIR = /www/imgsort2
# INSTALL_DIR =
INSTALL_DIR = /tmp/install/dir
@ -39,7 +39,7 @@ endif
SRC_DIR = src
RES_DIR = resources
_SRC_FLS = config.html config.js index.html index.js imgsort.php style.css style.css.map
_SRC_FLS = config.html config.js index.html index.js imgsort.php style.css
SRC_FLS = $(foreach f,$(_SRC_FLS),$(SRC_DIR)/$(f))
INSTALL_FLS = $(foreach f,$(_SRC_FLS),$(INSTALL_DIR)/$(f)) $(INSTALL_DIR)/favicon.png
SASS_CMD = sass --color --load-path=src/sass
@ -59,8 +59,8 @@ $(INSTALL_DIR)/%.png: $(RES_DIR)/%.png
$(INSTALL_DIR)/%: $(SRC_DIR)/%
install -m 0744 $< $@
%.conf: $(SRC_DIR)/%.conf
sed 's|root = .*|$$root = $(INSTALL_DIR);|; s|location /images/|location $(ROOT_PATH)/|; s|$$alias = .*|alias = $(ROOT_DIR);|' $< > $@
%.conf: $(RES_DIR)/%.conf
sed 's|/www/imgsort2|$(INSTALL_DIR)|; s|/data/images|$(ROOT_DIR)|; s|/images|/$(ROOT_PATH)|;' $< > $@
chmod 0740 $@
clean:

View File

@ -0,0 +1,35 @@
# vi: ft=nginx
server {
listen 8080 default_server;
server_name localhost;
# Optional security related headers
# add_header Content-Security-Policy "default-src 'self';";
# add_header Strict-Transport-Security "max-age=31536000;"; # includeSubDomains"
# add_header X-Frame-Options "SAMEORIGIN";
# add_header X-Content-Type-Options "nosniff";
# add_header Referrer-Policy "origin-when-cross-origin";
# access_log /var/log/nginx/imgsort2-access.log;
# error_log /var/log/nginx/imgsort2-error.log;
root /www/imgsort2;
index index.html;
location /images {
alias /data/images;
}
# TODO: Access restriction
# https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
# auth_basic "Imgsort 2";
# auth_basic_user_file /etc/www/.imgsort2.htpasswd;
location ~ .*\.php$ {
# TODO: this depends on your php-fpm configuration
fastcgi_pass unix:/var/run/php/php-fpm-imgsort2.sock;
include fastcgi.conf;
}
}

View File

@ -0,0 +1,20 @@
; vi: ft=dosini
[imgsort2]
php_admin_value[disable_functions] = php_uname,getmyuid,getmypid,passthru,leak,listen,diskfreespace,tmpfile,link,ignore_user_abord,dl,set_time_limit,exec,shell_exec,system,highlight_file,source,show_source,fpaththru,virtual,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,proc_get_status,proc_nice,proc_terminate,phpinfo
php_admin_value[open_basedir] = /www/imgsort2:/data/images
php_admin_value[error_log] = /var/log/php-fpm/imgsort2.log
php_admin_value[display_errors] = on
user = www-data
group = www-data
listen = /var/run/php/php-fpm-imgsort2.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1
pm.process_idle_timeout = 10s