Both sides previous revisionPrevious revisionNext revision | Previous revision |
servers:bsd:nginx:piwigo [2025/05/16 21:05] – Sean Rhone | servers:bsd:nginx:piwigo [2025/05/16 21:55] (current) – [config.inc.php] Sean Rhone |
---|
* Piwigo ((https://piwigo.org/)) | * Piwigo ((https://piwigo.org/)) |
* Bootstrap Darkroom Theme ((https://github.com/Piwigo/piwigo-bootstrap-darkroom)) | * Bootstrap Darkroom Theme ((https://github.com/Piwigo/piwigo-bootstrap-darkroom)) |
* ''master'' Branches ((https://github.com/Piwigo/Piwigo/tree/master)) ((https://github.com/Piwigo/piwigo-bootstrap-darkroom/tree/master)) | |
* [[Information:Realm of Espionage]] | * [[Information:Realm of Espionage]] |
* https://media.realmofespionage.xyz | * https://media.realmofespionage.xyz |
| |
* :!: WIP | |
| |
===== Prerequisites ===== | ===== Prerequisites ===== |
* https://github.com/Piwigo/piwigo-bootstrap-darkroom/commits/master/ | * https://github.com/Piwigo/piwigo-bootstrap-darkroom/commits/master/ |
| |
sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/Piwigo.git' '/var/www/media' && sudo git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/piwigo-bootstrap-darkroom.git' '/var/www/media/themes/bootstrap_darkroom' && sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/var/www/media(/.*)?' && sudo restorecon -F -I -R '/var/www/media' && sudo chown -R 'nginx':'nginx' '/var/www/media' && sync | su - |
| |
| git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/Piwigo.git' '/usr/local/www/media' && chown -R 'www':'www' '/usr/local/www/media' && sync |
| |
| git clone --branch 'master' --depth '1' --recurse-submodules 'https://github.com/Piwigo/piwigo-bootstrap-darkroom.git' '/usr/local/www/media/themes/bootstrap_darkroom' && chown -R 'www':'www' '/usr/local/www/media' && sync |
| |
====== Database ====== | ====== Database ====== |
===== PHP-FPM Socket ===== | ===== PHP-FPM Socket ===== |
| |
sudo -e '/etc/php-fpm.d/media.conf' && sudo systemctl restart 'php-fpm' | su - |
| |
| ee '/usr/local/etc/php-fpm.d/media.conf' && service 'php_fpm' restart |
| |
<code> | <code> |
| |
; User/Group | ; User/Group |
user = nginx | user = www |
group = nginx | group = www |
| |
; Socket | ; Socket |
listen = /run/php-fpm/media.sock | listen = 127.0.0.1:9003 |
listen.acl_users = nginx | |
listen.allowed_clients = 127.0.0.1 | listen.allowed_clients = 127.0.0.1 |
| |
pm.max_children = 4 | pm.max_children = 4 |
pm.process_idle_timeout = 30 | pm.process_idle_timeout = 30 |
| |
; Fedora php.ini Defaults | |
php_value[session.save_handler] = "files" | |
php_value[session.save_path] = "/var/lib/php/session" | |
| |
; General | ; General |
===== FastCGI ===== | ===== FastCGI ===== |
| |
sudo -e '/etc/nginx/default.d/media.conf' | su - |
| |
| ee '/usr/local/etc/nginx/default.d/media.conf' |
| |
<code> | <code> |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
fastcgi_param PATH_INFO $fastcgi_path_info; | fastcgi_param PATH_INFO $fastcgi_path_info; |
fastcgi_pass unix:/run/php-fpm/media.sock; | fastcgi_param HTTPS on; |
}</code> | fastcgi_pass 127.0.0.1:9003; |
| } |
| |
| # End</code> |
| |
===== Server Block ===== | ===== Server Block ===== |
| |
* 2023/09/12: CSPs disabled; TODO: Re-figure out CSPs | su - |
| |
sudo -e '/etc/nginx/vhosts.d/media.conf' && sudo systemctl reload 'nginx' && sync | ee '/usr/local/etc/nginx/vhosts.d/media.conf' && service 'nginx' reload && sync |
| |
<code> | <code> |
server { | server { |
listen '443' 'ssl' 'http2'; | listen '443' 'ssl'; |
| # http2 'on'; |
server_name 'media.realmofespionage.xyz'; | server_name 'media.realmofespionage.xyz'; |
root '/var/www/media'; | root '/usr/local/www/media'; |
index 'index.php'; | index 'index.php'; |
| |
include '/etc/nginx/default.d/media.conf'; | include '/usr/local/etc/nginx/default.d/media.conf'; |
include '/etc/nginx/default.d/headers.conf'; | include '/usr/local/etc/nginx/default.d/headers.conf'; |
| |
# add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'" always; | # add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'" always; |
} | } |
| |
}</code> | } |
| |
| # End</code> |
| |
====== Initial Setup ====== | ====== Initial Setup ====== |
// Minimal Logging | // Minimal Logging |
$conf['log_level'] = 'EMERGENCY'; | $conf['log_level'] = 'EMERGENCY'; |
| |
| // Hide PHP Warnings |
| $conf['show_php_errors'] = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING; |
| |
// Header Links | // Header Links |
'https://realmofespionage.xyz' => 'Realm of Espionage', | 'https://realmofespionage.xyz' => 'Realm of Espionage', |
'https://wiki.realmofespionage.xyz' => 'RoE | Wiki', | 'https://wiki.realmofespionage.xyz' => 'RoE | Wiki', |
'https://social.realmofespionage.xyz/profile/espionage724' => 'RoE | Social', | |
'https://blog.realmofespionage.xyz' => 'RoE | Blog', | 'https://blog.realmofespionage.xyz' => 'RoE | Blog', |
'https://wiki.realmofespionage.xyz/personal:social_media' => 'Webmaster Info', | 'https://wiki.realmofespionage.xyz/user:espionage724' => 'Webmaster Info', |
'https://wiki.realmofespionage.xyz/servers:nginx:piwigo' => 'Instance Configuration Notes', | 'https://wiki.realmofespionage.xyz/servers:bsd:nginx:piwigo' => 'Instance Configuration Notes', |
); | ); |
| |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media' fsck --full --strict" | su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media' fsck --full --strict" |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media' rm --cached -r ." | |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media' add --renormalize ." | |
| |
==== Theme ==== | ==== Theme ==== |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media/themes/bootstrap_darkroom' fsck --full --strict" | su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media/themes/bootstrap_darkroom' fsck --full --strict" |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media/themes/bootstrap_darkroom' rm --cached -r ." | |
| |
su -m 'www' -c "'/usr/local/bin/git' -C '/usr/local/www/media/themes/bootstrap_darkroom' add --renormalize ." | |
| |
====== Services ====== | ====== Services ====== |