User Tools

Site Tools


servers:nginx:joomla

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
servers:nginx:joomla [2019/12/15 10:32] – [PHP-FPM Socket] Sean Rhoneservers:nginx:joomla [2024/02/01 08:08] – No more keywords https://forum.joomla.org/viewtopic.php?t=989140 Sean Rhone
Line 1: Line 1:
 ====== Information ====== ====== Information ======
  
-  * Joomla((https://www.joomla.org)) +  * Joomla ((https://www.joomla.org)) 
-  * T3 Framework ((http://www.t3-framework.org)) +  * :!: 5.1-dev ((https://github.com/joomla/joomla-cms/tree/5.1-dev))
-  * Purity III ((https://www.joomlart.com/joomla/templates/purity-iii))+
   * [[Information:Realm of Espionage]]   * [[Information:Realm of Espionage]]
   * https://realmofespionage.xyz   * https://realmofespionage.xyz
Line 9: Line 8:
 ===== Prerequisites ===== ===== Prerequisites =====
  
-  * [[distros:ubuntu_server|Ubuntu Server]]+  * [[distros:fedora_server|Fedora Server]]
   * [[servers:mariadb|MariaDB]]   * [[servers:mariadb|MariaDB]]
   * [[servers:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]   * [[servers:nginx_php_php-fpm|nginx + PHP + PHP-FPM]]
Line 16: Line 15:
 ===== Notes ===== ===== Notes =====
  
-  * Use ''#'' as a URL when a blank menu item is needed +  * Purity III ThemeMagic is not available with Joomla 4.x ([[https://www.joomlart.com/forums/d/46542-theme-magic-option-is-not-visible/2|source]]) 
-  * New Window With Navigation is needed in order to have external links open in a new tab + 
-  * Icons should be 16x16 when shown in Menus and Titles need to have a space before them so the icon and text aren't too close to each other +====== Dependencies ====== 
-  * Youtube's and Facebook's menu icon has to be named something other than ''youtube'' and ''facebook'' for it to display for some reason ((youtub and faceboo work)) + 
-  * Optimizing CSS from Purity III/T3 Templates seems to cause the hamburger icon for mobile to not show+  * https://docs.joomla.org/Special:MyLanguage/J5.x:Setting_Up_Your_Local_Environment 
 +  * https://manual.joomla.org/docs/next/get-started/technical-requirements/ 
 +  * https://docs.joomla.org/J5.x:Optional_Technical_Requirements 
 +  * ''php8-ldap'' isn't required but ''composer install'' complains about it unless you ignore platform dependencies 
 + 
 +  sudo dnf install composer nodejs php-ldap php-mysqlnd 
 + 
 +===== Old openSUSE ===== 
 + 
 +**** 
 + 
 +  sudo zypper install php8-sodium nodejs-common php-composer2 php8-mysql php8-fileinfo php8-ldap
  
 ====== Download Source ====== ====== Download Source ======
Line 26: Line 36:
 **** ****
  
-  sudo git clone --branch 'staging' --depth '1' --recurse-submodules 'https://github.com/joomla/joomla-cms.git' '/var/www/main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && sync+  sudo git clone --branch '5.1-dev' --depth '1' --recurse-submodules 'https://github.com/joomla/joomla-cms.git' '/var/www/main' && sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/var/www/main(/.*)?' && sudo restorecon -F -I -R '/var/www/main' && sudo chown -R 'nginx':'nginx' '/var/www/main' && sync 
 + 
 +====== Environment ====== 
 + 
 +  * https://docs.joomla.org/Special:MyLanguage/J5.x:Setting_Up_Your_Local_Environment 
 + 
 +===== Composer ===== 
 + 
 +  sudo su 'nginx' -'/bin/bash' 
 + 
 +  cd '/var/www/main' && composer install 
 + 
 +===== Node.js ===== 
 + 
 +  sudo su 'nginx' -s '/bin/bash' 
 + 
 +  cd '/var/www/main' && npm ci && npm audit fix && sync
  
 ====== Database ====== ====== Database ======
  
-  sudo mysql+  sudo mariadb
  
-  CREATE DATABASE joomla;+  CREATE DATABASE joomla_db;
  
-  GRANT ALL PRIVILEGES ON joomla.* to 'joomla'@'localhost' IDENTIFIED BY 'x';+  GRANT ALL PRIVILEGES ON joomla_db.* to 'joomla'@'localhost' IDENTIFIED BY 'x';
  
   FLUSH PRIVILEGES;   FLUSH PRIVILEGES;
Line 44: Line 70:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php/7.2/fpm/pool.d/main.conf' && sudo systemctl restart 'php7.2-fpm'+  sudo -e '/etc/php-fpm.d/main.conf' && sudo systemctl restart 'php-fpm'
  
 <code> <code>
 [main] [main]
-user = www-data 
-group = www-data 
  
-listen = /run/php/main.sock +; User/Group 
-listen.owner www-data +user = nginx 
-listen.group = www-data+group = nginx 
 + 
 +; Socket 
 +listen = /run/php-fpm/main.sock 
 +listen.acl_users nginx
 listen.allowed_clients = 127.0.0.1 listen.allowed_clients = 127.0.0.1
  
-pm = dynamic +; Process Management 
-pm.max_children = 8 +pm = ondemand 
-pm.start_servers +pm.max_children = 4 
-pm.min_spare_servers = 2 +pm.process_idle_timeout 30
-pm.max_spare_servers = 4+
  
-php_value[date.timezone] = "America/New_York+; Fedora php.ini Defaults 
-php_value[upload_tmp_dir] = "/tmp"+php_value[session.save_handler] = "files
 +php_value[session.save_path] = "/var/lib/php/session"
  
 +; General
 +php_value[date.timezone] = "America/New_York"
 php_value[max_execution_time] = "200" php_value[max_execution_time] = "200"
 php_value[memory_limit] = "512M" php_value[memory_limit] = "512M"
-php_value[post_max_size] = "10M+php_value[post_max_size] = "30M
-php_value[upload_max_filesize] = "10M"+php_value[upload_max_filesize] = "30M" 
 +php_value[post_max_size] = "30M"
 php_value[max_file_uploads] = "100" php_value[max_file_uploads] = "100"
 +php_value[upload_tmp_dir] = "/tmp"
  
-php_value[session.save_handler] = "files" +; End</code>
-php_value[session.save_path] = "/var/lib/php/sessions" +
-php_value[soap.wsdl_cache_dir] = "/var/lib/php/wsdlcache" +
-php_value[opcache.file_cache] = "/var/lib/php/opcache"</code>+
  
 ===== FastCGI ===== ===== FastCGI =====
  
-  sudo -e '/etc/nginx/snippets/main.conf'+  sudo -e '/etc/nginx/default.d/main.conf'
  
 <code> <code>
Line 84: Line 113:
 location ~ \.(php|phar)(/.*)?$ { location ~ \.(php|phar)(/.*)?$ {
     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;     fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;
- 
     fastcgi_intercept_errors on;     fastcgi_intercept_errors on;
     fastcgi_index index.php;     fastcgi_index index.php;
     include fastcgi_params;     include fastcgi_params;
-    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/main.sock;+    fastcgi_pass unix:/run/php-fpm/main.sock;
 }</code> }</code>
  
 ===== Server Block ===== ===== Server Block =====
  
-  sudo -e '/etc/nginx/sites-available/main.conf'+  * 2023/09/12: CSPs disabled; TODO: Re-figure out CSPs 
 +  * [[https://docs.joomla.org/Nginx|Nginx - Joomla! Documentation]] 
 + 
 +  sudo -e '/etc/nginx/vhosts.d/main.conf' && sudo systemctl restart 'nginx' && sync
  
 <code> <code>
Line 104: Line 135:
     index 'index.php';     index 'index.php';
  
-    include '/etc/nginx/snippets/main.conf'; +    include '/etc/nginx/default.d/main.conf'; 
-    include '/etc/nginx/snippets/headers.conf';+    include '/etc/nginx/default.d/headers.conf';
  
-    client_max_body_size '10M';+    client_max_body_size '30M';
  
-    add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'" always;+#    add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'" always;
  
 #    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/ {
 + try_files $uri $uri/ /api/index.php?$args;
 +    }
  
     location / {     location / {
Line 122: Line 157:
         error_page 403 /403_error.html;         error_page 403 /403_error.html;
     }     }
-}</code> 
  
-==== Enable ====+    location ~* \.(ico|pdf|flv)$ { 
 +        expires 1y; 
 +    }
  
-**** +    location ~\.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ { 
- +        expires 14d; 
-  sudo rm -f '/etc/nginx/sites-enabled/main.conf' && sudo ln -s '/etc/nginx/sites-available/main.conf' '/etc/nginx/sites-enabled/main.conf' && sudo systemctl reload 'nginx' && sync+    } 
 +  
 +}</code>
  
 ====== Initial Setup ====== ====== Initial Setup ======
  
   * https://realmofespionage.xyz   * https://realmofespionage.xyz
 +  * :!: If Joomla gives a 500 error, it's likely the ''sessions'' folder not having the right permissions, see [[servers:nginx_php_php-fpm#permissions]]
  
-====== Plugins ====== +====== Settings ======
- +
-===== T3 Framework ===== +
- +
-  * https://github.com/t3framework/t3/archive/master.zip+
  
 ===== Purity III Template ===== ===== Purity III Template =====
  
-  * https://www.joomlart.com/joomla/templates/purity-iii ((only the template is needed)) +  * [[https://www.joomlart.com/joomla/templates/purity-iii|Purity III]]
-  * Requires [[servers:nginx:joomla#t3_framework T3 Framework]]+
  
-  * Latest known version: 1.1.8+==== Install ====
  
-====== Settings ======+  * [[https://www.joomlart.com/member/downloads/joomlart/free-templates/purity-iii|Downloads]] 
 +  * Install T3 Framework and Purity III from that downloads page
  
-===== Global Configuration =====+==== System Dashboard ====
  
-==== Site Meta Description ====+  * Templates -> Site Template Styles 
 +  * Set ''purity_III - Default'' to Default
  
-****+==== Theme Settings ====
  
-  Realm of Espionage is a personal project composed of various self-hosted services. All services are hosted in-house under secure conditions, and notes are provided for all services under the CC-BY-SA 4.0 license.+  * General -> Show T3 Logo: Off
  
-==== Site Meta Keywords ====+  * Theme -> Logo Type: Text 
 +  * Theme -> Site Name: ''Realm of Espionage''
  
-****+  Navigation -> Megamenu Configuration -> Animation: Fading 
 +  Navigation -> Megamenu Configuration -> Duration: ''300''
  
-  privacy,linux,floss,foss,free,open,open-source,gnu,secure,hardened,ubuntu,espionage724,gaming,realm of espionage,roe,free and open-source software,transparent,transparency,letsencrypt,freedom,decentralized,self-host,self-hosted,in-house,decentralization+  * Add-ons -> Off-canvas Sidebar -> Enable: Off
  
-==== Content Rights ====+  * Assignment -> Toggle Selection
  
-****+==== Footer ====
  
-  Creative Commons Attribution-ShareAlike 4.0 International+=== Copyright ===
  
-==== Articles ====+  * Last tested: 2024/02/01 on Joomla 5.1.0-dev, T3 Framework 3.2.0, and Purity III 2.1.0
  
-  * System > Global Configuration > Articles+== Logo ==
  
-  Show Title: Hide +****
-  Show Category: Hide +
-  Show Author: Hide +
-  Show Publish Date: Hide +
-  * Show Navigation: Hide +
-  * Show Print: Hide +
-  * Show Email: Hide +
-  * Show Hits: Hide+
  
-==== Menu ====+  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
  
-  * Menus > Main Menu > Home > Page Display+== Text ==
  
-  * Show Page Heading: No+  * Place text within the ''<section class="t3-copyright">'' section underneath the ''Bootstrap by Twitter'' and ''Font Awesome'' mentions 
 +  * Remove ''Bootstrap by Twitter'' and ''Font Awesome'' mentions
  
-===== Purity III =====+  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'
  
-==== Edit Style ====+<code> 
 +          <small> 
 +            <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>
  
-  * Show T3 Logo Off ((if shown, it causes a 3rd-party asset to be loaded; why they didn't just include it in the theme files is beyond me)) +==== Custom CSS ====
-  * Logo Type Text +
-  * Megamenu Animation Fading (300ms) +
-  * Off-canvas Sidebar Off ((it doesn't play nicely with the [[servers:nginx:joomla#position_fix | footer position fix]] TODO: Verify this since the footer fix has been changed))+
  
-==== Theme Magic ====+  * :!: 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
  
-=== Brand Primary 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'
  
-  #3D8BFF+<code> 
 +html,
  
-=== Footer Background ===+body { 
 +  height: 100%; 
 +}
  
-****+a { 
 +  color: #3D8BFF; 
 +}
  
-  #484848+a:hover { 
 +  color: #196BE4; 
 +}
  
-=== Footer Text Color ===+.t3-mainnav { 
 +  background-color: #3D8BFF; 
 +}
  
-****+.logo a { 
 +  background: none; 
 +}
  
-  #FFFFFF+.logo a:hover { 
 +  background: #196BE4; 
 +}
  
-===== Footer =====+.t3-wrapper { 
 +  position: relative; 
 +  min-height: 100%; 
 +}
  
-==== Copyright ====+.t3-footer { 
 +  position: absolute; 
 +  bottom: 0; 
 +  left: 0; 
 +  right: 0; 
 +  background-color: #484848; 
 +  color: #FFFFFF; 
 +}
  
-  * Requires [[servers:nginx:joomla#purity_iii|Purity III Template]]+.t3-copyright { 
 +  padding-top20px; 
 +  padding-bottom0px; 
 +}</code>
  
-=== Logo ===+===== Articles =====
  
-****+==== Home ====
  
-  sudo -H -u 'www-datawget 'https://licensebuttons.net/l/by-sa/4.0/80x15.png-O '/var/www/main/images/cc-by-sa-40.png'+  * The line-breaks are intentional and are there to make how it displays look nicer 
 +  * Add links to ''RoE | Wiki'' and ''CC BY-SA 4.0 license''
  
-=== Text ===+<code>  
 + 
  
-  * Place text within the ''<section class="t3-copyright">'' section underneath the ''Bootstrap by Twitter'' and ''Font Awesome'' mentions +Welcome! Realm of Espionage is a personal project composed of various services. All services on RoE are free and open-source, self-hosted, and configured with strict security in-mind. My most prominent project currently is RoE | Wiki, a DokuWiki instance that holds my notes on all sorts of operating system, client, and server deployments, free for anyone to view and redistribute under the CC BY-SA 4.0 license.
-  * Remove ''Bootstrap by Twitter'' and ''Font Awesome'' mentions+
  
-  sudo -H -u 'www-data' -e '/var/www/main/templates/purity_iii/tpls/blocks/footer.php'+ 
  
-<code> +This domain serves as a landing page and provides links to my most-used profiles and projectsTo view them, use the navigation bar (desktop) or the ≡ hamburger icon (mobile) at the top of the screen.
-          <small> +
-            <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>+
  
-=== Position Fix ===+ </code>
  
-  * This places the footer back at the bottom of the screen instead of floating half-way up the page when little content exists +===== Menus =====
-  * This also shrinks the footer height a bit +
-  * Fix adapted from https://www.joomlart.com/forums/topic/footer-on-bottom-of-screen-not-sticky/#post-898349 +
-  * Requires [[servers:nginx:joomla#purity_iii | Purity III Template]]+
  
-  sudo --'www-data' -'/var/www/main/templates/purity_iii/css/custom.css'+  * Main menu headers are: System Links -> URL -''#'' to allow tapping as-expected on mobile 
 +  * Icon sizes are 24x24 
 +  * Menu entries should be named normally before saving for a proper ''alias'', and then add a space on the title afterwards to make it look better with the icon
  
-  html, +===== Global Configuration =====
-   +
-  body { +
-    height: 100%; +
-  } +
-   +
-  .t3-wrapper { +
-    position: relative; +
-    min-height: 100%; +
-  } +
-   +
-  .t3-footer { +
-    position: absolute; +
-    bottom: 0; +
-    left: 0; +
-    right: 0; +
-  } +
-   +
-  .t3-copyright { +
-    padding-top: 20px; +
-    padding-bottom: 0px; +
-  }+
  
-==== T3 Footer Remove ====+==== Site Meta Description ====
  
-  Unused currently, but may be useful if Joomla's native footer is to be used in-place of t3's+****
  
-  .t3-copyright { +  Realm of Espionage is a personal project composed of various self-hosted servicesAll services are hosted in-house under secure conditions, and notes are provided for all services under the CC-BY-SA 4.0 license.
-      display: none; +
-  }+
  
-===== Articles =====+==== Content Rights ====
  
-==== Home ====+****
  
-  * The line-breaks are intentional and are there to make how it displays look nicer +  Creative Commons Attribution-ShareAlike 4.0 International
-  * Add links to ''RoE | Wiki'' and ''CC BY-SA 4.0 license''+
  
-<code>  +==== Articles ====
- +
  
-Welcome! Realm of Espionage is a personal project composed of various services. All services on RoE are free and open-source, self-hosted, and configured with strict security in-mind. My most prominent project currently is RoE | Wiki, a DokuWiki instance that holds my notes on all sorts of operating system, client, and server deployments, free for anyone to view and redistribute under the CC BY-SA 4.0 license.+  * System -> Global Configuration -> Articles
  
- +  * Show Title: Hide 
 +  * Show Category: Hide 
 +  * Show Author: Hide 
 +  * Show Publish Date: Hide 
 +  * Show Navigation: Hide 
 +  * Show Print: Hide 
 +  * Show Email: Hide 
 +  * Show Hits: Hide
  
-This domain serves as a landing page and provides links to my most-used profiles and projects. To view them, use the navigation bar (desktop) or the hamburger icon (mobile) at the top of the screen.+==== Menu ====
  
- </code>+  * Menus -> Main Menu -> Home -> Link Type -> Display in Menu: No 
 +  * Menus -> Main Menu -> Home -> Page Display -Show Page Heading: Hide
  
 ====== Services ====== ====== Services ======
Line 304: Line 343:
  
 ==== Service ==== ==== Service ====
 +
 +  * 2023/09/12: TODO: SELinux prevents various actions with ''npm''; is it even needed?
  
   sudo -e '/etc/systemd/system/main-up.service'   sudo -e '/etc/systemd/system/main-up.service'
Line 309: Line 350:
 <code> <code>
 [Service] [Service]
-User=www-data +User=nginx 
-Group=www-data+Group=nginx
 Type=oneshot Type=oneshot
-ExecStart='/usr/bin/git' -C '/var/www/main' pull origin 'staging+WorkingDirectory=/var/www/main 
-ExecStartPost='/bin/sync'</code>+Environment="COMPOSER_CACHE_DIR=/dev/null" 
 +ExecStart='/usr/bin/git' -C '/var/www/main' pull origin '4.4-dev' 
 +ExecStart='/usr/bin/composer' install 
 +#ExecStart='/usr/bin/npm' ci --logs-max='0' 
 +#ExecStart='/usr/bin/npm' audit fix --audit-level='none' --logs-max='0
 +ExecStartPost='/usr/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 319: Line 365:
   * Every day at ''03:00:00''   * Every day at ''03:00:00''
  
-  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
  
 <code> <code>
 [Unit] [Unit]
-Description=JoomlaGit Updater+Description=Joomla Git Updater
 After=network-online.target After=network-online.target
 Wants=network-online.target Wants=network-online.target
Line 342: Line 388:
 <code> <code>
 [Service] [Service]
-User=www-data +User=nginx 
-Group=www-data+Group=nginx
 Type=oneshot Type=oneshot
 ExecStart='/usr/bin/git' -C '/var/www/main' gc --aggressive --prune='all' ExecStart='/usr/bin/git' -C '/var/www/main' gc --aggressive --prune='all'
 ExecStart='/usr/bin/git' -C '/var/www/main' fsck --full --strict ExecStart='/usr/bin/git' -C '/var/www/main' fsck --full --strict
-ExecStartPost='/bin/sync'</code>+ExecStartPost='/usr/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 357: Line 403:
 <code> <code>
 [Unit] [Unit]
-Description=JoomlaMaintenance+Description=Joomla Maintenance
 After=network-online.target After=network-online.target
 Wants=network-online.target Wants=network-online.target
Line 380: Line 426:
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www WorkingDirectory=/var/www
-ExecStart='/bin/bash' -c '"/bin/tar" -cvzf "/home/CHANGEME/backups/joomla-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "main"' +ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/joomla-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "main"' 
-ExecStartPost='/bin/sync'</code>+ExecStartPost='/usr/bin/sync'</code>
  
 === Timer === === Timer ===
Line 391: Line 437:
 <code> <code>
 [Unit] [Unit]
-Description=JoomlaFiles Backup+Description=Joomla Files Backup
  
 [Timer] [Timer]
Line 404: Line 450:
 === Database Auth === === Database Auth ===
  
-  sudo -'mysql' -e '/var/lib/mysql/auth/joomla' && sudo chmod '600' '/var/lib/mysql/auth/joomla'+  sudo mkdir -'/var/lib/mysql/auth&& sudo -e '/var/lib/mysql/auth/joomla' && sudo chown -R 'mysql':'mysql' '/var/lib/mysql/auth/joomla' && sudo chmod '600' '/var/lib/mysql/auth/joomla' && sync
  
 <code> <code>
-[mysqldump]+[mariadb-dump]
 user=joomla user=joomla
 password=x</code> password=x</code>
Line 413: Line 459:
 === Service === === Service ===
  
-  mkdir -p ~/'backups' && sudo -'mysql' mkdir -'/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 -'/var/lib/mysql/tmp&& sudo chown -R 'mysql':'mysql' '/var/lib/mysql/tmp' && sudo chmod '600' '/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'
  
 <code> <code>
Line 419: Line 465:
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/lib/mysql/tmp WorkingDirectory=/var/lib/mysql/tmp
-ExecStartPre='/usr/bin/mysqldump' --defaults-extra-file='/var/lib/mysql/auth/joomla' --single-transaction 'joomla' -r '/var/lib/mysql/tmp/joomla.sql' +ExecStartPre='/usr/bin/mariadb-dump' --defaults-extra-file='/var/lib/mysql/auth/joomla' --single-transaction 'joomla_db' -r '/var/lib/mysql/tmp/joomla.sql' 
-ExecStart='/bin/gzip' -f '/var/lib/mysql/tmp/joomla.sql' +ExecStart='/usr/bin/gzip' -f '/var/lib/mysql/tmp/joomla.sql' 
-ExecStart='/bin/bash' -c '"/bin/mv" "/var/lib/mysql/tmp/joomla.sql.gz" "/home/CHANGEME/backups/joomla-database-auto-"$$(date +%%Y-%%m-%%d)".sql.gz"' +ExecStart='/usr/bin/bash' -c '"/usr/bin/mv" "/var/lib/mysql/tmp/joomla.sql.gz" "/home/CHANGEME/backups/joomla-database-auto-"$$(date +%%Y-%%m-%%d)".sql.gz"' 
-ExecStartPost='/bin/sync'</code>+ExecStartPost='/usr/bin/sync'</code>
  
 === Timer === === Timer ===
Line 432: Line 478:
 <code> <code>
 [Unit] [Unit]
-Description=JoomlaDatabase Backup+Description=Joomla Database Backup
 After=mariadb.service After=mariadb.service
  
Line 452: Line 498:
 **** ****
  
-  sudo systemctl stop nginx php7.2-fpm+  sudo systemctl stop nginx php-fpm
  
 ==== Backup Folder ==== ==== Backup Folder ====
Line 464: Line 510:
 **** ****
  
-  sudo mysqldump --defaults-extra-file='/var/lib/mysql/auth/joomla' --single-transaction 'joomla' -r ~/'joomla-database-manual-'$(date +%Y-%m-%d)'.sql' && sync+  sudo mariadb-dump --defaults-extra-file='/var/lib/mysql/auth/joomla' --single-transaction 'joomla_db' -r ~/'joomla-database-manual-'$(date +%Y-%m-%d)'.sql' && sync
  
 ==== Start Services ==== ==== Start Services ====
Line 470: Line 516:
 **** ****
  
-  sudo systemctl start nginx php7.2-fpm+  sudo systemctl start nginx php-fpm
  
 ===== Client ===== ===== Client =====
Line 478: Line 524:
 **** ****
  
-  scp espionage724@192.168.1.153:~/'joomla-files-'*'.tar.gz' espionage724@192.168.1.153:~/'joomla-database-'*'.sql' ~/'Downloads' && sync+  scp espionage724@192.168.1.152:~/'joomla-files-'*'.tar.gz' espionage724@192.168.1.152:~/'joomla-database-'*'.sql' ~/'Downloads' && sync
  
 ====== Restore ====== ====== Restore ======
Line 494: Line 540:
 **** ****
  
-  scp ~/'Downloads/joomla-files-'*'.tar.gz' ~/'Downloads/joomla-database-'*'.sql' espionage724@192.168.1.153:~+  scp ~/'Downloads/joomla-files-'*'.tar.gz' ~/'Downloads/joomla-database-'*'.sql' espionage724@192.168.1.152:~
  
 ==== Remove Files ==== ==== Remove Files ====
Line 508: Line 554:
 **** ****
  
-  sudo systemctl stop nginx php7.2-fpm+  sudo systemctl stop nginx php-fpm
  
-==== Restore JoomlaFolder ====+==== Restore Joomla Folder ====
  
 **** ****
  
-  cd '/var/www' && sudo tar -xvzf ~/'joomla-files-'*'.tar.gz' 'main' && sudo chown -R 'www-data':'www-data' '/var/www/main' && cd ~ && sync+  cd '/var/www' && sudo tar -xvzf ~/'joomla-files-'*'.tar.gz' 'main' && sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' '/var/www/main(/.*)?' && sudo restorecon -F -I -R '/var/www/main' && sudo chown -R 'nginx':'nginx' '/var/www/main' && cd ~ && sync
  
 ==== Drop Previous Database ==== ==== Drop Previous Database ====
  
-  sudo mysql+  sudo mariadb
  
-  DROP DATABASE joomla;+  DROP DATABASE joomla_db;
  
   FLUSH TABLES;   FLUSH TABLES;
Line 528: Line 574:
 ==== Re-create Databases ==== ==== Re-create Databases ====
  
-  sudo mysql+  sudo mariadb
  
-  CREATE DATABASE joomla;+  CREATE DATABASE joomla_db;
  
   EXIT   EXIT
Line 538: Line 584:
 **** ****
  
-  sudo mysql 'joomla' < ~/'joomla-database-'*'.sql' && sync+  sudo mariadb 'joomla_db' < ~/'joomla-database-'*'.sql' && sync
  
 ==== Reapply Permissions ==== ==== Reapply Permissions ====
  
-  sudo mysql+  sudo mariadb
  
-  GRANT ALL PRIVILEGES ON joomla.* to 'joomla'@'localhost' IDENTIFIED BY 'x';+  GRANT ALL PRIVILEGES ON joomla_db.* to 'joomla'@'localhost' IDENTIFIED BY 'x';
  
   FLUSH PRIVILEGES;   FLUSH PRIVILEGES;
Line 554: Line 600:
 **** ****
  
-  sudo systemctl start nginx php7.2-fpm+  sudo systemctl start nginx php-fpm
  
 ==== Remove Backups ==== ==== Remove Backups ====
  
-  * Verify that Joomlaworks before running+  * Verify that Joomla works before running
  
   rm ~/'joomla-files-'*'.tar.gz' ~/'joomla-database-'*'.sql' && sync   rm ~/'joomla-files-'*'.tar.gz' ~/'joomla-database-'*'.sql' && sync
 +
/var/www/wiki/data/pages/servers/nginx/joomla.txt · Last modified: 2024/02/01 08:15 by Sean Rhone