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
servers:nginx:joomla [2019/06/28 21:46] – [Database] Sean Rhoneservers:nginx:joomla [2024/08/13 22:19] (current) – removed Sean Rhone
Line 1: Line 1:
-====== Information ====== 
  
-  * Joomla! ((https://www.joomla.org)) 
-  * T3 Framework ((http://www.t3-framework.org)) 
-  * Purity III ((https://www.joomlart.com/joomla/templates/purity-iii)) 
-  * [[Information:Realm of Espionage]] 
-  * https://realmofespionage.xyz 
- 
-===== Prerequisites ===== 
- 
-  * [[distros:fedora_server|Fedora Server]] 
-  * [[servers:mariadb | MariaDB]] 
-  * [[servers:nginx_php_php-fpm | nginx + PHP + PHP-FPM]] 
-  * [[servers:nginx:lets_encrypt | Let's Encrypt]] 
- 
-===== Notes ===== 
- 
-  * Use ''#'' as a URL when a blank menu item is needed 
-  * 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 
-  * 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 
- 
-====== Download Source ====== 
- 
-**** 
- 
-  sudo git clone --branch 'staging' --depth '1' --recurse-submodules 'https://github.com/joomla/joomla-cms.git' '/var/www/main' && sudo chown -R 'nginx':'nginx' '/var/www/main' && sync 
- 
-===== SELinux ===== 
- 
-  sudo semanage fcontext --deleteall "/var/www/main(/.*)?" 
- 
-  sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' "/var/www/main(/.*)?" 
- 
-  sudo restorecon -R -v '/var/www/main' && sync 
- 
-====== Database ====== 
- 
-  mysql --user='root' --password 
- 
-  CREATE DATABASE joomla; 
- 
-  GRANT ALL PRIVILEGES ON joomla.* to 'joomla'@'localhost' IDENTIFIED BY 'x'; 
- 
-  FLUSH PRIVILEGES; 
- 
-====== nginx + PHP-FPM Configuration ====== 
- 
-===== PHP-FPM Socket ===== 
- 
-  sudo -e '/etc/php-fpm.d/main.conf' && sudo systemctl restart 'php-fpm' 
- 
-<code> 
-[main] 
-user = nginx 
-group = nginx 
- 
-listen = /run/php-fpm/main.sock 
-listen.owner = nginx 
-listen.group = nginx 
-listen.allowed_clients = 127.0.0.1 
- 
-pm = dynamic 
-pm.max_children = 8 
-pm.start_servers = 3 
-pm.min_spare_servers = 2 
-pm.max_spare_servers = 4 
- 
-php_value[date.timezone] = "America/New_York" 
-php_value[upload_tmp_dir] = "/tmp" 
- 
-php_value[max_execution_time] = "200" 
-php_value[memory_limit] = "512M" 
-php_value[post_max_size] = "10M" 
-php_value[upload_max_filesize] = "10M" 
-php_value[max_file_uploads] = "100" 
- 
-php_value[session.save_handler] = files 
-php_value[session.save_path] = /var/lib/php/session 
-php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache 
-php_value[opcache.file_cache] = /var/lib/php/opcache</code> 
- 
-===== FastCGI ===== 
- 
-  sudo -e '/etc/nginx/default.d/main.conf' 
- 
-<code> 
-# PHP-FPM 
-location ~ \.(php|phar)(/.*)?$ { 
-    fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; 
- 
-    fastcgi_intercept_errors on; 
-    fastcgi_index index.php; 
-    include fastcgi_params; 
-    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name; 
-    fastcgi_param PATH_INFO $fastcgi_path_info; 
-    fastcgi_pass unix:/run/php-fpm/main.sock; 
-}</code> 
- 
-===== Server Block ===== 
- 
-  sudo -e '/etc/nginx/conf.d/main.conf' && sudo systemctl reload 'nginx' 
- 
-<code> 
-server { 
-    listen '443' 'ssl' 'http2'; 
-    server_name 'realmofespionage.xyz'; 
-    root '/var/www/main'; 
-    index 'index.php'; 
- 
-    include '/etc/nginx/default.d/main.conf'; 
-    include '/etc/nginx/default.d/headers.conf'; 
- 
-    client_max_body_size '10M'; 
- 
-    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; 
-#    error_log  /var/log/nginx/main-error.log; 
- 
-    location / { 
-        try_files $uri $uri/ /index.php?$args; 
-    } 
- 
-    location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { 
-        return 403; 
-        error_page 403 /403_error.html; 
-    } 
-}</code> 
- 
-====== Initial Setup ====== 
- 
-  * https://realmofespionage.xyz 
- 
-====== Plugins ====== 
- 
-===== T3 Framework ===== 
- 
-  * https://github.com/t3framework/t3/archive/master.zip 
- 
-===== Purity III Template ===== 
- 
-  * https://www.joomlart.com/joomla/templates/purity-iii ((only the template is needed)) 
-  * Requires [[servers:nginx:joomla#t3_framework | T3 Framework]] 
- 
-  * Latest known version: 1.1.8 
- 
-====== Settings ====== 
- 
-===== Global Configuration ===== 
- 
-==== Site Meta Description ==== 
- 
-**** 
- 
-  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. 
- 
-==== Site Meta Keywords ==== 
- 
-**** 
- 
-  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 
- 
-==== Content Rights ==== 
- 
-**** 
- 
-  Creative Commons Attribution-ShareAlike 4.0 International 
- 
-==== Articles ==== 
- 
-  * 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 
- 
-==== Menu ==== 
- 
-  * Menus > Main Menu > Home > Page Display 
- 
-  * Show Page Heading: No 
- 
-===== Purity III ===== 
- 
-==== Edit Style ==== 
- 
-  * 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)) 
-  * 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 ==== 
- 
-=== Brand Primary Color === 
- 
-**** 
- 
-  #3D8BFF 
- 
-=== Footer Background === 
- 
-**** 
- 
-  #484848 
- 
-=== Footer Text Color === 
- 
-**** 
- 
-  #FFFFFF 
- 
-===== Footer ===== 
- 
-==== Copyright ==== 
- 
-  * Requires [[servers:nginx:joomla#purity_iii|Purity III Template]] 
- 
-=== Logo === 
- 
-**** 
- 
-  sudo -H -u 'nginx' wget 'https://licensebuttons.net/l/by-sa/4.0/80x15.png' -O '/var/www/main/images/cc-by-sa-40.png' 
- 
-=== Text === 
- 
-  * 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 
- 
-  sudo -H -u 'nginx' -e '/var/www/main/templates/purity_iii/tpls/blocks/footer.php' 
- 
-<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> 
- 
-=== Position Fix === 
- 
-  * This places the footer back at the bottom of the screen instead of floating half-way up the page when little content exists 
-  * 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 -H -u 'nginx' -e '/var/www/main/templates/purity_iii/css/custom.css' 
- 
-  html, 
-   
-  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 ==== 
- 
-  * Unused currently, but may be useful if Joomla's native footer is to be used in-place of t3's 
- 
-  .t3-copyright { 
-      display: none; 
-  } 
- 
-===== Articles ===== 
- 
-==== Home ==== 
- 
-  * 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'' 
- 
-<code>  
-  
- 
-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. 
- 
-  
- 
-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. 
- 
- </code> 
- 
-====== Services ====== 
- 
-===== Updater ===== 
- 
-==== Service ==== 
- 
-  sudo -e '/etc/systemd/system/main-up.service' 
- 
-<code> 
-[Service] 
-User=nginx 
-Group=nginx 
-Type=oneshot 
-ExecStart='/usr/bin/git' -C '/var/www/main' pull origin 'staging' 
-ExecStartPost='/usr/bin/sync'</code> 
- 
-==== Timer ==== 
- 
-  * 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 
- 
-<code> 
-[Unit] 
-Description=Joomla! Git Updater 
-After=network-online.target 
-Wants=network-online.target 
- 
-[Timer] 
-OnCalendar=*-*-* 03:00:00 
-Persistent=true 
- 
-[Install] 
-WantedBy=timers.target</code> 
- 
-===== Maintenance ===== 
- 
-==== Service ==== 
- 
-  sudo -e '/etc/systemd/system/main-m.service' 
- 
-<code> 
-[Service] 
-User=nginx 
-Group=nginx 
-Type=oneshot 
-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'</code> 
- 
-==== Timer ==== 
- 
-  * ''01'' day of every month at ''03:20:00'' 
- 
-  sudo -e '/etc/systemd/system/main-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-m.timer' --now 
- 
-<code> 
-[Unit] 
-Description=Joomla! Maintenance 
-After=network-online.target 
-Wants=network-online.target 
- 
-[Timer] 
-OnCalendar=*-*-01 03:20:00 
-Persistent=true 
- 
-[Install] 
-WantedBy=timers.target</code> 
- 
-===== Backup ===== 
- 
-==== Files ==== 
- 
-=== Service === 
- 
-  mkdir -p ~/'backups' && sudo -e '/etc/systemd/system/main-fb.service' && sudo sed -i 's/CHANGEME/'$USER'/g' '/etc/systemd/system/main-fb.service' 
- 
-<code> 
-[Service] 
-Type=oneshot 
-WorkingDirectory=/var/www 
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -cvzf "/home/CHANGEME/backups/joomla-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "main"' 
-ExecStartPost='/usr/bin/sync'</code> 
- 
-=== Timer === 
- 
-  * ''01'' day of every month at ''03:50:00'' 
- 
-  sudo -e '/etc/systemd/system/main-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'main-fb.timer' --now && sudo systemctl start 'main-fb' && sudo systemctl status 'main-fb' -l 
- 
-<code> 
-[Unit] 
-Description=Joomla! Files Backup 
- 
-[Timer] 
-OnCalendar=*-*-01 03:50:00 
-Persistent=true 
- 
-[Install] 
-WantedBy=timers.target</code> 
- 
-==== Database ==== 
- 
-=== Database Auth === 
- 
-  sudo -u 'mysql' -e '/var/lib/mysql/auth/joomla' && sudo chmod '600' '/var/lib/mysql/auth/joomla' 
- 
-<code> 
-[mysqldump] 
-user=joomla 
-password=x</code> 
- 
-=== Service === 
- 
-  mkdir -p ~/'backups' && sudo -u 'mysql' 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' 
- 
-<code> 
-[Service] 
-Type=oneshot 
-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' 
-ExecStart='/usr/bin/gzip' -f '/var/lib/mysql/tmp/joomla.sql' 
-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='/usr/bin/sync'</code> 
- 
-=== Timer === 
- 
-  * Every day at ''03:15:00'' 
- 
-  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 
- 
-<code> 
-[Unit] 
-Description=Joomla! Database Backup 
-After=mariadb.service 
- 
-[Timer] 
-OnCalendar=*-*-* 03:15:00 
-Persistent=true 
- 
-[Install] 
-WantedBy=timers.target</code> 
- 
-====== Backup ====== 
- 
-  * Create backup archive on server and transfer to client computer 
- 
-===== Server ===== 
- 
-==== Stop Services ==== 
- 
-**** 
- 
-  sudo systemctl stop nginx php-fpm 
- 
-==== Backup Folder ==== 
- 
-**** 
- 
-  cd '/var/www' && sudo tar -cvzf ~/'joomla-files-manual-'$(date +%Y-%m-%d)'.tar.gz' 'main' && cd ~ && sync 
- 
-==== Backup Database ==== 
- 
-**** 
- 
-  sudo -u 'mysql' mysqldump --defaults-extra-file='/var/lib/mysql/auth/joomla' --single-transaction 'joomla' -r ~/'joomla-database-manual-'$(date +%Y-%m-%d)'.sql' && sync 
- 
-==== Start Services ==== 
- 
-**** 
- 
-  sudo systemctl start nginx php-fpm 
- 
-===== Client ===== 
- 
-==== Transfer Files To Client ==== 
- 
-**** 
- 
-  scp espionage724@192.168.1.153:~/'joomla-files-'*'.tar.gz' espionage724@192.168.1.153:~/'joomla-database-'*'.sql' ~/'Downloads' && sync 
- 
-====== Restore ====== 
- 
-===== Client ===== 
- 
-==== Uncompress Database ==== 
- 
-  * This is only needed if restoring an **automated** database backup ((manual doesn't gzip)) 
- 
-  gunzip ~/'Downloads/joomla-database-'*'.sql.gz' 
- 
-==== Transfer Files To Server ==== 
- 
-**** 
- 
-  scp ~/'Downloads/joomla-files-'*'.tar.gz' ~/'Downloads/joomla-database-'*'.sql' espionage724@192.168.1.153:~ 
- 
-==== Remove Files ==== 
- 
-**** 
- 
-  rm -f ~/'Downloads/joomla-files-'*'.tar.gz' ~/'Downloads/joomla-database-'*'.sql' && sync 
- 
-===== Server ===== 
- 
-==== Stop Services ==== 
- 
-**** 
- 
-  sudo systemctl stop nginx php-fpm 
- 
-==== Restore Joomla! Folder ==== 
- 
-**** 
- 
-  cd '/var/www' && sudo tar -xvzf ~/'joomla-files-'*'.tar.gz' 'main' && sudo chown -R 'nginx':'nginx' '/var/www/main' && cd ~ && sync 
- 
-==== SELinux ==== 
- 
-  sudo semanage fcontext --deleteall "/var/www/main(/.*)?" 
- 
-  sudo semanage fcontext --add --type 'httpd_sys_rw_content_t' "/var/www/main(/.*)?" 
- 
-  sudo restorecon -R -v '/var/www/main' && sync 
- 
-==== Drop Previous Database ==== 
- 
-  mysql --user='root' --password 
- 
-  DROP DATABASE joomla; 
- 
-  FLUSH TABLES; 
- 
-==== Re-create Databases ==== 
- 
-  mysql --user='root' --password 
- 
-  CREATE DATABASE joomla; 
- 
-==== Restore Database ==== 
- 
-**** 
- 
-  mysql --user='root' --password 'joomla' < ~/'joomla-database-'*'.sql' && sync 
- 
-==== Reapply Permissions ==== 
- 
-  mysql --user='root' --password 
- 
-  GRANT ALL PRIVILEGES ON joomla.* to 'joomla'@'localhost' IDENTIFIED BY 'x'; 
- 
-  FLUSH PRIVILEGES; 
- 
-==== Start Services ==== 
- 
-**** 
- 
-  sudo systemctl start nginx php-fpm 
- 
-==== Remove Backups ==== 
- 
-  * Verify that Joomla! works before running 
- 
-  rm ~/'joomla-files-'*'.tar.gz' ~/'joomla-database-'*'.sql' && sync 
C:/www/wiki/data/attic/servers/nginx/joomla.1561772764.txt.gz · Last modified: by Sean Rhone