| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:linux:nginx:joomla [2025/12/22 05:39] – Sean Rhone | servers:linux:nginx:joomla [2026/01/01 08:08] (current) – [Service] Sean Rhone |
|---|
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[linux:distros:server:ubuntu_server|Ubuntu Server]] | * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (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 apt install composer nodejs npm php-xml php-gd php-mysql php-mbstring php-mcrypt php-curl php-intl php-json php-ldap | sudo zypper install nodejs-common php-composer2 php-gd php8-intl php-ldap php8-mysql php8-openssl php8-sodium php8-fileinfo php8-mbstring |
| |
| ====== Download Source ====== | ====== Download Source ====== |
| * https://github.com/joomla/joomla-cms/branches | * https://github.com/joomla/joomla-cms/branches |
| |
| 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' | sudo git clone --branch '6.1-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' |
| |
| ====== Environment ====== | ====== Environment ====== |
| ===== Composer ===== | ===== Composer ===== |
| |
| sudo su 'www-data' -s '/bin/bash' | sudo su 'wwwrun' -s '/bin/bash' |
| |
| cd '/tmp' && composer --working-dir='/var/www/main' --no-cache install --no-dev | cd '/tmp' && '/usr/bin/composer' --working-dir='/srv/www/main' --no-cache install --no-dev |
| |
| ===== Node.js ===== | ===== Node.js ===== |
| |
| sudo su 'www-data' -s '/bin/bash' | sudo su 'wwwrun' -s '/bin/bash' |
| |
| cd '/tmp' && '/usr/bin/node' '/usr/share/nodejs/npm/bin/npm-cli.js' --prefix '/var/www/main' ci --force --loglevel='silent' | cd '/tmp' && '/usr/bin/npm' --prefix '/srv/www/main' ci --verbose |
| |
| exit | exit |
| ===== PHP-FPM Socket ===== | ===== PHP-FPM Socket ===== |
| |
| sudo -e '/etc/php/8.4/fpm/pool.d/main.conf' && sudo systemctl restart 'php8.4-fpm' | sudo -e '/etc/php8/fpm/php-fpm.d/main.conf' && sudo systemctl restart 'php-fpm' |
| |
| <code> | <code> |
| |
| ; User/Group | ; User/Group |
| user = "www-data" | user = "wwwrun" |
| group = "www-data" | group = "www" |
| |
| ; Socket | ; Socket |
| listen = "/run/php/main.sock" | listen = "/run/php-fpm/main.sock" |
| listen.owner = "www-data" | listen.owner = "wwwrun" |
| listen.group = "www-data" | listen.group = "www" |
| listen.mode = "0662" | listen.mode = "0662" |
| |
| php_value[log_errors] = "0" | php_value[log_errors] = "0" |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| | |
| | ; openSUSE php.ini Defaults |
| | php_value[session.save_path] = "/var/lib/php8/sessions" |
| |
| ; General | ; General |
| ===== FastCGI ===== | ===== FastCGI ===== |
| |
| sudo -e '/etc/nginx/snippets/main.conf' | sudo -e '/etc/nginx/default.d/main.conf' |
| |
| <code> | <code> |
| fastcgi_param 'HTTPS' 'on'; | fastcgi_param 'HTTPS' 'on'; |
| |
| fastcgi_pass 'unix:/run/php/main.sock'; | fastcgi_pass 'unix:/run/php-fpm/main.sock'; |
| |
| } | } |
| <code> | <code> |
| server { | server { |
| listen '443' 'ssl'; | |
| http2 'on'; | |
| server_name 'realmofespionage.xyz'; | |
| root '/var/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 '/srv/www/main'; |
| | index 'index.php'; |
| |
| client_max_body_size '30M'; | include '/etc/nginx/default.d/main.conf'; |
| | include '/etc/nginx/default.d/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'; |
| } | } |
| | |
| } | } |
| * https://github.com/joomla/joomla-cms/issues/43876 | * https://github.com/joomla/joomla-cms/issues/43876 |
| |
| sudo rm -fv '/var/www/main/administrator/cache/autoload_psr4.php' | sudo rm -fv '/srv/www/main/administrator/cache/autoload_psr4.php' |
| |
| ====== Settings ====== | ====== Settings ====== |
| | |
| | * Disable Sample plugins |
| | * Trash Guided Tours |
| | * Site Template Styles -> ''[x]'' Cassiopeia Extended - Default |
| |
| ==== System Dashboard ==== | ==== System Dashboard ==== |
| **** | **** |
| |
| wget -O '/tmp/cc-by-sa-40.png' 'https://licensebuttons.net/l/by-sa/4.0/80x15.png' && sudo mv '/tmp/cc-by-sa-40.png' '/var/www/main/images/cc-by-sa-40.png' && sudo chown 'nginx':'nginx' '/var/www/main/images/cc-by-sa-40.png' && sudo restorecon -F -I -R '/var/www/main/images/cc-by-sa-40.png' && sync | wget -O '/tmp/cc-by-sa-40.png' 'https://licensebuttons.net/l/by-sa/4.0/80x15.png' && sudo mv '/tmp/cc-by-sa-40.png' '/srv/www/main/images/cc-by-sa-40.png' && sudo chown 'nginx':'nginx' '/srv/www/main/images/cc-by-sa-40.png' && sudo restorecon -F -I -R '/srv/www/main/images/cc-by-sa-40.png' && sync |
| |
| == Text == | == Text == |
| * Remove ''Bootstrap by Twitter'' and ''Font Awesome'' mentions | * Remove ''Bootstrap by Twitter'' and ''Font Awesome'' mentions |
| |
| sudo -e '/var/www/main/templates/purity_iii/tpls/blocks/footer.php' && sudo chown 'nginx':'nginx' '/var/www/main/templates/purity_iii/tpls/blocks/footer.php' | sudo -e '/srv/www/main/templates/purity_iii/tpls/blocks/footer.php' && sudo chown 'nginx':'nginx' '/srv/www/main/templates/purity_iii/tpls/blocks/footer.php' |
| |
| <code> | <code> |
| <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 'wwwrun':'www' '/etc/nginx/scripts/main/git-fix.sh' |
| | |
| | <code> |
| | #!/bin/bash |
| | |
| | cd '/tmp' |
| | |
| | '/usr/bin/rm' -Rf '/srv/www/main/.git' |
| | '/usr/bin/git' -C '/srv/www/main' init --initial-branch='6.1-dev' |
| | '/usr/bin/git' -C '/srv/www/main' add '.' |
| | |
| | ######################################## |
| | '/usr/bin/git' -C '/srv/www/main' config 'user.email' 'espionage724@x' |
| | ######################################## |
| | |
| | '/usr/bin/git' -C '/srv/www/main' commit --message='x' |
| | |
| | '/usr/bin/git' -C '/srv/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' |
| | '/usr/bin/git' -C '/srv/www/main' pull --depth '1' --recurse-submodules 'origin' '6.1-dev' --rebase |
| | |
| | '/usr/bin/git' -C '/srv/www/main' reset --hard 'origin/6.1-dev' |
| | '/usr/bin/git' -C '/srv/www/main' gc --aggressive --prune='all' |
| | '/usr/bin/git' -C '/srv/www/main' fsck --full --strict |
| | |
| | # End</code> |
| | |
| | ==== Execute ==== |
| | |
| | sudo su 'wwwrun' -s '/bin/bash' |
| | |
| | '/etc/nginx/scripts/main/git-fix.sh' |
| | |
| | exit |
| |
| ====== Services ====== | ====== Services ====== |
| <code> | <code> |
| [Service] | [Service] |
| User=www-data | User=wwwrun |
| Group=www-data | Group=www |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/var/www/blog | WorkingDirectory=/srv/www/main |
| Environment="COMPOSER_CACHE_DIR=/dev/null" | Environment="COMPOSER_CACHE_DIR=/dev/null" |
| |
| ExecStart='/usr/bin/git' -C '/var/www/main' reset --hard 'origin/6.1-dev' | ExecStart='/usr/bin/git' -C '/srv/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/git' -C '/srv/www/main' pull origin '6.1-dev' --rebase |
| |
| ExecStart='/usr/bin/composer' --working-dir='/var/www/main' --no-cache install --no-dev | ExecStart='/usr/bin/composer' --working-dir='/srv/www/main' --no-cache install --no-dev |
| ExecStart='/usr/bin/npm' --prefix '/var/www/main' ci --logs-max='0' | ExecStart='/usr/bin/npm' --prefix '/srv/www/main' ci --logs-max='0' |
| |
| | ExecStartPost='/usr/bin/rm' -f '/srv/www/main/administrator/cache/autoload_psr4.php' |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/var/www/main | WorkingDirectory=/srv/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"' | 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"' |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| === Database Auth === | === Database Auth === |
| |
| sudo mkdir -p '/var/lib/mysql/auth' && sudo -e '/var/lib/mysql/auth/joomla' && sudo chown 'mysql':'mysql' '/var/lib/mysql/auth/joomla' && sudo chmod '0600' '/var/lib/mysql/auth/joomla' | sudo mkdir -p '/srv/lib/mysql/auth' && sudo -e '/srv/lib/mysql/auth/joomla' && sudo chown 'mysql':'mysql' '/srv/lib/mysql/auth/joomla' && sudo chmod '0600' '/srv/lib/mysql/auth/joomla' |
| |
| <code> | <code> |
| === Service === | === Service === |
| |
| mkdir -p ~/'backups' && sudo mkdir -p '/var/lib/mysql/tmp' && sudo -e '/etc/systemd/system/main-db.service' && sudo sed -i 's/'CHANGEME'/'$USER'/g' '/etc/systemd/system/main-db.service' | mkdir -p ~/'backups' && sudo mkdir -p '/srv/lib/mysql/tmp' && sudo -e '/etc/systemd/system/main-db.service' && sudo sed -i 's/'CHANGEME'/'$USER'/g' '/etc/systemd/system/main-db.service' |
| |
| <code> | <code> |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/var/lib/mysql | WorkingDirectory=/srv/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="/srv/lib/mysql/auth/joomla" --single-transaction --quick "joomla_db" -r "/home/CHANGEME/backups/joomla-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| <code> | <code> |
| [Service] | [Service] |
| User=www-data | User=wwwrun |
| Group=www-data | Group=www |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/var/www/main | WorkingDirectory=/srv/www/main |
| |
| ExecStart='/usr/bin/git' -C '/var/www/main' gc --aggressive --prune='all' | ExecStart='/usr/bin/git' -C '/srv/www/main' gc --aggressive --prune='all' |
| ExecStart='/usr/bin/git' -C '/var/www/main' fsck --full --strict | ExecStart='/usr/bin/git' -C '/srv/www/main' fsck --full --strict |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| **** | **** |
| |
| sudo tar -czf ~/'joomla-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/var/www' 'main' | sudo tar -czf ~/'joomla-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'main' |
| |
| ===== Database ===== | ===== Database ===== |
| **** | **** |
| |
| ls ~/'joomla-files-'*'.tar.gz' && sudo rm -Rf '/var/www/main' | ls ~/'joomla-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/main' |
| |
| ===== Restore Files ===== | ===== Restore Files ===== |
| **** | **** |
| |
| 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' | 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' |
| |
| ===== Git Fix ===== | ===== Git Fix ===== |
| * :!: Set email for ''user.email'' | * :!: Set email for ''user.email'' |
| |
| sudo su 'www-data' -s '/bin/bash' | sudo su 'wwwrun' -s '/bin/bash' |
| |
| rm -Rf '/var/www/main/.git' | rm -Rf '/srv/www/main/.git' |
| |
| git -C '/var/www/main' init --initial-branch='6.1-dev' | git -C '/srv/www/main' init --initial-branch='6.1-dev' |
| |
| git -C '/var/www/main' add '.' | git -C '/srv/www/main' add '.' |
| |
| git -C '/var/www/main' config 'user.email' 'espionage724@x' | git -C '/srv/www/main' config 'user.email' 'espionage724@x' |
| |
| git -C '/var/www/main' commit --message='x' | git -C '/srv/www/main' commit --message='x' |
| |
| git -C '/var/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' | git -C '/srv/www/main' remote add 'origin' 'https://github.com/joomla/joomla-cms.git' |
| |
| git -C '/var/www/main' pull --depth '1' --recurse-submodules 'origin' '6.1-dev' --rebase | git -C '/srv/www/main' pull --depth '1' --recurse-submodules 'origin' '6.1-dev' --rebase |
| |
| git -C '/var/www/main' reset --hard 'origin/6.1-dev' | git -C '/srv/www/main' reset --hard 'origin/6.1-dev' |
| |
| git -C '/var/www/main' gc --aggressive --prune='all' | git -C '/srv/www/main' gc --aggressive --prune='all' |
| |
| git -C '/var/www/main' fsck --full --strict | git -C '/srv/www/main' fsck --full --strict |
| |
| exit | exit |