| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:linux:nginx:joomla [2025/10/16 23:53] – [Service] Sean Rhone | servers:linux:nginx:joomla [2025/12/22 20:30] (current) – Sean Rhone |
|---|
| |
| * Joomla | * Joomla |
| * Purity III | |
| * [[information:realm_of_espionage|Realm of Espionage]] | * [[information:realm_of_espionage|Realm of Espionage]] |
| * https://realmofespionage.xyz | * https://realmofespionage.xyz |
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]] | * [[linux:distros:server:ubuntu_server|Ubuntu Server]] |
| * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] | * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] |
| * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]] |
| * https://docs.joomla.org/J5.x:Optional_Technical_Requirements | * https://docs.joomla.org/J5.x:Optional_Technical_Requirements |
| |
| sudo zypper install nodejs-common php-composer2 php-gd php8-intl php-ldap php8-mysql php8-openssl php8-sodium php8-fileinfo php8-mbstring | sudo apt install composer nodejs npm php-xml php-gd php-mysql php-mbstring php-mcrypt php-curl php-intl php-json php-ldap |
| |
| ====== Download Source ====== | ====== Download Source ====== |
| |
| * https://github.com/joomla/joomla-cms/commits/5.4-dev/ | * https://github.com/joomla/joomla-cms/commits/6.1-dev/ |
| * https://github.com/joomla/joomla-cms/branches | * https://github.com/joomla/joomla-cms/branches |
| * :!: 2025/09/11: T3 extension doesn't install on ''6.0-dev'' | |
| |
| sudo git clone --branch '5.4-dev' --depth '1' --recurse-submodules 'https://github.com/joomla/joomla-cms.git' '/srv/www/main' && sudo chown -R 'wwwrun':'www' '/srv/www/main' && sudo chmod -R '0755' '/srv/www/main' | sudo git clone --branch '6.1-dev' --depth '1' --recurse-submodules 'https://github.com/joomla/joomla-cms.git' '/var/www/main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && sudo chmod -R '0755' '/var/www/main' |
| |
| ====== Environment ====== | ====== Environment ====== |
| ===== Composer ===== | ===== Composer ===== |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| cd '/tmp' && composer --working-dir='/srv/www/main' --no-cache install --no-dev | cd '/tmp' && composer --working-dir='/var/www/main' --no-cache install --no-dev |
| |
| ===== Node.js ===== | ===== Node.js ===== |
| |
| sudo su 'wwwrun' -s '/bin/bash' | * ''--force'' allow unsupported ''npm'' 9 |
| |
| cd '/tmp' && npm --prefix '/srv/www/main' ci | sudo su 'www-data' -s '/bin/bash' |
| | |
| | cd '/tmp' && CYPRESS_CACHE_FOLDER='/var/www/main' '/usr/bin/node' '/usr/share/nodejs/npm/bin/npm-cli.js' --prefix '/var/www/main' ci --cache '/var/www/main' --force --verbose |
| |
| exit | exit |
| ===== PHP-FPM Socket ===== | ===== PHP-FPM Socket ===== |
| |
| sudo -e '/etc/php8/fpm/php-fpm.d/main.conf' && sudo systemctl restart 'php-fpm' | sudo -e '/etc/php/8.4/fpm/pool.d/main.conf' && sudo systemctl restart 'php8.4-fpm' |
| |
| <code> | <code> |
| |
| ; User/Group | ; User/Group |
| user = "wwwrun" | user = "www-data" |
| group = "www" | group = "www-data" |
| |
| ; Socket | ; Socket |
| listen = "/run/php-fpm/main.sock" | listen = "/run/php/main.sock" |
| listen.owner = "wwwrun" | listen.owner = "www-data" |
| listen.group = "www" | listen.group = "www-data" |
| listen.mode = "0662" | listen.mode = "0662" |
| |
| pm.process_idle_timeout = "30" | pm.process_idle_timeout = "30" |
| |
| ; openSUSE php.ini Defaults | ; Logging |
| php_value[session.save_path] = "/var/lib/php8/sessions" | |
| | |
| ; General | |
| php_value[log_errors] = "0" | php_value[log_errors] = "0" |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| | |
| | ; General |
| php_value[date.timezone] = "America/New_York" | php_value[date.timezone] = "America/New_York" |
| php_value[max_execution_time] = "200" | |
| php_value[memory_limit] = "512M" | |
| php_value[post_max_size] = "30M" | |
| php_value[upload_max_filesize] = "30M" | |
| php_value[max_file_uploads] = "100" | |
| |
| ; End</code> | ; End</code> |
| ===== FastCGI ===== | ===== FastCGI ===== |
| |
| * ''main.sock'' | sudo -e '/etc/nginx/snippets/main.conf' |
| | |
| sudo -e '/etc/nginx/default.d/main.conf' | |
| |
| <code> | <code> |
| location ~ \.(php|phar)(/.*)?$ { | location '~' '\.(php|phar)(/.*)?$' { |
| fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; | |
| fastcgi_intercept_errors on; | fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'; |
| fastcgi_index index.php; | fastcgi_intercept_errors 'on'; |
| include fastcgi_params; | fastcgi_index 'index.php'; |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | include 'fastcgi_params'; |
| fastcgi_param PATH_INFO $fastcgi_path_info; | fastcgi_param 'SCRIPT_FILENAME' '$document_root$fastcgi_script_name'; |
| fastcgi_pass unix:/run/php-fpm/main.sock; | fastcgi_param 'PATH_INFO' '$fastcgi_path_info'; |
| | fastcgi_param 'HTTPS' 'on'; |
| | |
| | fastcgi_pass 'unix:/run/php/main.sock'; |
| } | } |
| |
| * [[https://docs.joomla.org/Nginx|Nginx - Joomla! Documentation]] | * [[https://docs.joomla.org/Nginx|Nginx - Joomla! Documentation]] |
| |
| sudo -e '/etc/nginx/vhosts.d/main.conf' && sudo systemctl reload 'nginx' | sudo -e '/etc/nginx/sites-available/main.conf' |
| |
| <code> | <code> |
| server { | server { |
| listen '443' 'ssl'; | |
| http2 'on'; | |
| server_name 'realmofespionage.xyz'; | |
| root '/srv/www/main'; | |
| index 'index.php'; | |
| |
| include '/etc/nginx/default.d/main.conf'; | listen '443' 'ssl'; |
| include '/etc/nginx/default.d/headers.conf'; | http2 'on'; |
| | server_name 'realmofespionage.xyz'; |
| | root '/var/www/main'; |
| | index 'index.php'; |
| |
| client_max_body_size '30M'; | include '/etc/nginx/snippets/main.conf'; |
| | include '/etc/nginx/snippets/headers.conf'; |
| |
| # access_log /var/log/nginx/main-access.log; | # access_log '/var/log/nginx/main-access.log'; |
| # error_log /var/log/nginx/main-error.log; | # error_log '/var/log/nginx/main-error.log'; |
| |
| location /api/ { | location '/api/' { |
| try_files $uri $uri/ /api/index.php?$args; | try_files '$uri' '$uri/' '/api/index.php?$args'; |
| } | } |
| |
| location / { | location '/' { |
| try_files $uri $uri/ /index.php?$args; | try_files '$uri' '$uri/' '/index.php?$args'; |
| } | } |
| |
| location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { | location '~*' '/(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$' { |
| return 403; | return '403'; |
| error_page 403 /403_error.html; | error_page '403' '/403_error.html'; |
| } | } |
| |
| location ~* \.(ico|pdf|flv)$ { | location '~*' '\.(ico|pdf|flv)$' { |
| expires 1y; | expires '1y'; |
| } | } |
| |
| location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { | location '~*' '\.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$' { |
| expires 14d; | expires '14d'; |
| } | } |
| | |
| } | } |
| |
| # End</code> | # End</code> |
| | |
| | sudo ln -s -f '/etc/nginx/sites-available/main.conf' '/etc/nginx/sites-enabled/main.conf' && sudo systemctl reload 'nginx' |
| |
| ====== Initial Setup ====== | ====== Initial Setup ====== |
| * https://github.com/joomla/joomla-cms/issues/43876 | * https://github.com/joomla/joomla-cms/issues/43876 |
| |
| sudo rm -fv '/srv/www/main/administrator/cache/autoload_psr4.php' | sudo rm -fv '/var/www/main/administrator/cache/autoload_psr4.php' |
| |
| ====== Settings ====== | ====== Settings ====== |
| |
| ===== Purity III Template ===== | |
| |
| * [[https://www.joomlart.com/joomla/templates/purity-iii|Purity III]] | |
| |
| ==== Install ==== | |
| |
| * [[https://www.joomlart.com/member/downloads/joomlart/free-templates/purity-iii|Downloads]] | |
| * Download **Purity III Template** and **T3 System Plugin** (:!: not 20 MB+ quickstarts; **not** ''Purity III for Joomla 5'') | |
| |
| * ''t3-system-plugin_3.2.3.zip'' | |
| * ''purity-iii-template_2.1.1.zip'' | |
| |
| ==== System Dashboard ==== | ==== System Dashboard ==== |
| |
| ==== Theme Settings ==== | ==== Theme Settings ==== |
| |
| * General -> Show T3 Logo: Off | |
| |
| * Theme -> Logo Type: Text | |
| * Theme -> Site Name: ''Realm of Espionage'' | |
| |
| * Navigation -> Megamenu Configuration -> Animation: Fading | |
| * Navigation -> Megamenu Configuration -> Duration: ''300'' | |
| |
| * Add-ons -> Off-canvas Sidebar -> Enable: Off | |
| |
| * Assignment -> Toggle Selection | |
| |
| ==== Footer ==== | ==== Footer ==== |
| <img src="https://realmofespionage.xyz/images/cc-by-sa-40.png" width="80" height="15" /> All content and data available on Realm of Espionage is available under the <a href="https://creativecommons.org/licenses/by-sa/4.0" target="_blank">Creative Commons Attribution-ShareAlike 4.0 International</a> license. | <img src="https://realmofespionage.xyz/images/cc-by-sa-40.png" width="80" height="15" /> All content and data available on Realm of Espionage is available under the <a href="https://creativecommons.org/licenses/by-sa/4.0" target="_blank">Creative Commons Attribution-ShareAlike 4.0 International</a> license. |
| </small></code> | </small></code> |
| |
| ==== Custom CSS ==== | |
| |
| * :!: This shrinks the footer height, and places it back at the bottom of the screen instead of floating half-way up the page when little content exists ([[https://www.joomlart.com/forums/topic/footer-on-bottom-of-screen-not-sticky/#post-898349|source 1]], [[https://www.joomlart.com/documentation/joomla-faqs/css-related-issues#footer-sticky|source 2]]) | |
| * Also replaces ThemeMagic for Brand Primary Color, Footer Background, and Footer Text Color | |
| |
| * Last tested: 2024/02/01 on Joomla 5.1.0-dev, T3 Framework 3.2.0, and Purity III 2.1.0 | |
| |
| sudo -e '/var/www/main/templates/purity_iii/css/custom.css' && sudo chown 'nginx':'nginx' '/var/www/main/templates/purity_iii/css/custom.css' | |
| |
| <code> | |
| html, | |
| |
| body { | |
| height: 100%; | |
| } | |
| |
| a { | |
| color: #3D8BFF; | |
| } | |
| |
| a:hover { | |
| color: #196BE4; | |
| } | |
| |
| .t3-mainnav { | |
| background-color: #3D8BFF; | |
| } | |
| |
| .logo a { | |
| background: none; | |
| } | |
| |
| .logo a:hover { | |
| background: #196BE4; | |
| } | |
| |
| .t3-wrapper { | |
| position: relative; | |
| min-height: 100%; | |
| } | |
| |
| .t3-footer { | |
| position: absolute; | |
| bottom: 0; | |
| left: 0; | |
| right: 0; | |
| background-color: #484848; | |
| color: #FFFFFF; | |
| } | |
| |
| .t3-copyright { | |
| padding-top: 20px; | |
| padding-bottom: 0px; | |
| }</code> | |
| |
| ===== Articles ===== | ===== Articles ===== |
| * Menus -> Main Menu -> Home -> Link Type -> Display in Menu: No | * Menus -> Main Menu -> Home -> Link Type -> Display in Menu: No |
| * Menus -> Main Menu -> Home -> Page Display -> Show Page Heading: Hide | * Menus -> Main Menu -> Home -> Page Display -> Show Page Heading: Hide |
| | |
| | ====== Scripts ====== |
| | |
| | ===== Git Fix ===== |
| | |
| | * :!: Set email for ''user.email'' |
| | |
| | sudo mkdir -p '/etc/nginx/scripts/main' && sudo -e '/etc/nginx/scripts/main/git-fix.sh' && sudo chmod '0500' '/etc/nginx/scripts/main/git-fix.sh' && sudo chown 'www-data':'www-data' '/etc/nginx/scripts/main/git-fix.sh' |
| | |
| | <code> |
| | #!/bin/bash |
| | |
| | cd '/tmp' |
| | |
| | '/usr/bin/rm' -Rf '/var/www/main/.git' |
| | '/usr/bin/git' -C '/var/www/main' init --initial-branch='6.1-dev' |
| | '/usr/bin/git' -C '/var/www/main' add '.' |
| | |
| | ######################################## |
| | '/usr/bin/git' -C '/var/www/main' config 'user.email' 'espionage724@x' |
| | ######################################## |
| | |
| | '/usr/bin/git' -C '/var/www/main' commit --message='x' |
| | |
| | '/usr/bin/git' -C '/var/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' |
| | '/usr/bin/git' -C '/var/www/main' pull --depth '1' --recurse-submodules 'origin' '6.1-dev' --rebase |
| | |
| | '/usr/bin/git' -C '/var/www/main' reset --hard 'origin/6.1-dev' |
| | '/usr/bin/git' -C '/var/www/main' gc --aggressive --prune='all' |
| | '/usr/bin/git' -C '/var/www/main' fsck --full --strict |
| | |
| | # End</code> |
| | |
| | sudo -u 'www-data' '/etc/nginx/scripts/main/git-fix.sh' |
| |
| ====== Services ====== | ====== Services ====== |
| <code> | <code> |
| [Service] | [Service] |
| User=wwwrun | User=www-data |
| Group=www | Group=www-data |
| Type=oneshot | Type=oneshot |
| |
| Environment="COMPOSER_CACHE_DIR=/dev/null" | WorkingDirectory=/var/www/main |
| | Environment="CYPRESS_CACHE_FOLDER='/var/www/main'" |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/main' pull origin '5.4-dev' | ExecStart='/usr/bin/git' -C '/var/www/main' reset --hard 'origin/6.1-dev' |
| | ExecStart='/usr/bin/git' -C '/var/www/main' pull origin '6.1-dev' --rebase |
| |
| ExecStart='/usr/bin/composer' --working-dir='/srv/www/main' --no-cache install --no-dev | ExecStart='/usr/bin/composer' --working-dir='/var/www/main' --no-cache install --no-dev |
| ExecStart='/usr/bin/npm' --prefix '/srv/www/main' ci --logs-max='0' | ExecStart='/usr/bin/node' '/usr/share/nodejs/npm/bin/npm-cli.js' --prefix '/var/www/main' ci --cache '/var/www/main' --force --logs-max='0' |
| |
| | ExecStartPost='/usr/bin/rm' -f '/var/www/main/administrator/cache/autoload_psr4.php' |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| |
| ==== Timer ==== | ==== Timer ==== |
| |
| * Every day at ''03:00:00'' | * Daily ''03:00:00 AM'' |
| |
| sudo -e '/etc/systemd/system/main-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-up.timer' --now && sudo systemctl start 'main-up' && sudo systemctl status 'main-up' -l | sudo -e '/etc/systemd/system/main-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-up.timer' --now && sudo systemctl start 'main-up' && sudo systemctl status 'main-up' -l |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/joomla-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www" "main"' | WorkingDirectory=/var/www/main |
| | |
| | ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/joomla-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "main"' |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''03:15:00'' | * Monthly (4th) ''03:15:00 AM'' |
| |
| sudo -e '/etc/systemd/system/main-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-fb.timer' --now | sudo -e '/etc/systemd/system/main-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-fb.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 03:15:00 | OnCalendar=*-*-04 03:15:00 |
| Persistent=true | Persistent=true |
| |
| Group=mysql | Group=mysql |
| Type=oneshot | Type=oneshot |
| | |
| | WorkingDirectory=/var/lib/mysql |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/joomla" --single-transaction --quick "joomla_db" -r "/home/CHANGEME/backups/joomla-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' | ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/joomla" --single-transaction --quick "joomla_db" -r "/home/CHANGEME/backups/joomla-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''03:10:00'' | * Monthly (4th) ''03:10:00 AM'' |
| |
| sudo -e '/etc/systemd/system/main-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-db.timer' --now && sudo systemctl start 'main-db' && sudo systemctl status 'main-db' -l | sudo -e '/etc/systemd/system/main-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-db.timer' --now && sudo systemctl start 'main-db' && sudo systemctl status 'main-db' -l |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 03:10:00 | OnCalendar=*-*-04 03:10:00 |
| Persistent=true | Persistent=true |
| |
| <code> | <code> |
| [Service] | [Service] |
| User=wwwrun | User=www-data |
| Group=www | Group=www-data |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/main' reset --hard | WorkingDirectory=/var/www/main |
| ExecStart='/usr/bin/git' -C '/srv/www/main' gc --aggressive --prune='all' | |
| ExecStart='/usr/bin/git' -C '/srv/www/main' fsck --full --strict | ExecStart='/usr/bin/git' -C '/var/www/main' gc --aggressive --prune='all' |
| | ExecStart='/usr/bin/git' -C '/var/www/main' fsck --full --strict |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| ==== Timer ==== | ==== Timer ==== |
| |
| * ''01'' day of every month at ''03:30:00'' | * Monthly (4th) ''03:30:00 AM'' |
| |
| sudo -e '/etc/systemd/system/main-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-m.timer' --now | sudo -e '/etc/systemd/system/main-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-m.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 03:30:00 | OnCalendar=*-*-04 03:30:00 |
| Persistent=true | Persistent=true |
| |
| **** | **** |
| |
| sudo tar -czf ~/'joomla-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'main' | sudo tar -czf ~/'joomla-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/var/www' 'main' |
| |
| ===== Database ===== | ===== Database ===== |
| **** | **** |
| |
| ls ~/'joomla-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/main' | ls ~/'joomla-files-'*'.tar.gz' && sudo rm -Rf '/var/www/main' |
| |
| ===== Restore Files ===== | ===== Restore Files ===== |
| **** | **** |
| |
| sudo tar -xzf ~/'joomla-files-'*'.tar.gz' -C '/srv/www' 'main' && sudo chown -R 'wwwrun':'www' '/srv/www/main' && sudo chmod -R '0755' '/srv/www/main' | sudo tar -xzf ~/'joomla-files-'*'.tar.gz' -C '/var/www' 'main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && sudo chmod -R '0755' '/var/www/main' |
| |
| ===== Git Fix ===== | ===== Git Fix ===== |
| |
| * :!: Set email for ''user.email'' | * :!: Set email for ''user.email'' |
| * :!: T3 + Purity III need reinstalled | |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| rm -Rf '/srv/www/main/.git' | rm -Rf '/var/www/main/.git' |
| |
| git -C '/srv/www/main' init --initial-branch='5.4-dev' | git -C '/var/www/main' init --initial-branch='6.1-dev' |
| |
| git -C '/srv/www/main' add '.' | git -C '/var/www/main' add '.' |
| |
| git -C '/srv/www/main' config 'user.email' 'espionage724@x' | git -C '/var/www/main' config 'user.email' 'espionage724@x' |
| |
| git -C '/srv/www/main' commit --message='x' | git -C '/var/www/main' commit --message='x' |
| |
| git -C '/srv/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' | git -C '/var/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' |
| |
| git -C '/srv/www/main' pull --depth '1' --recurse-submodules 'origin' '5.4-dev' --rebase | git -C '/var/www/main' pull --depth '1' --recurse-submodules 'origin' '6.1-dev' --rebase |
| |
| git -C '/srv/www/main' reset --hard 'origin/5.4-dev' | git -C '/var/www/main' reset --hard 'origin/6.1-dev' |
| |
| git -C '/srv/www/main' gc --aggressive --prune='all' | git -C '/var/www/main' gc --aggressive --prune='all' |
| |
| git -C '/srv/www/main' fsck --full --strict | git -C '/var/www/main' fsck --full --strict |
| |
| exit | exit |