User Tools

Site Tools


servers:nginx:friendica

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
servers:nginx:friendica [2019/10/24 13:40] – Switch back to Ubuntu Server Sean Rhoneservers:nginx:friendica [2019/10/24 13:57] – Switch back to Ubuntu Server (completely) Sean Rhone
Line 22: Line 22:
 **** ****
  
-  cd '/var/www/social' && sudo -u 'nginx' COMPOSER_CACHE_DIR='/dev/null' '/var/www/social/bin/composer.phar' install --no-dev && sync+  cd '/var/www/social' && sudo -u 'www-data' COMPOSER_CACHE_DIR='/dev/null' '/var/www/social/bin/composer.phar' install --no-dev && sync
  
 ====== Database ====== ====== Database ======
  
-  mysql --user='root' --password+  sudo mysql
  
   CREATE DATABASE friendica;   CREATE DATABASE friendica;
Line 33: Line 33:
  
   FLUSH PRIVILEGES;   FLUSH PRIVILEGES;
 +
 +  EXIT
  
 ====== nginx + PHP-FPM Configuration ====== ====== nginx + PHP-FPM Configuration ======
Line 38: Line 40:
 ===== PHP-FPM Socket ===== ===== PHP-FPM Socket =====
  
-  sudo -e '/etc/php-fpm.d/social.conf' && sudo systemctl restart 'php-fpm'+  sudo -e '/etc/php/7.2/fpm/pool.d/social.conf' && sudo systemctl restart 'php7.2-fpm'
  
 <code> <code>
 [social] [social]
-user = nginx +user = www-data 
-group = nginx+group = www-data
  
-listen = /run/php-fpm/social.sock +listen = /run/php/social.sock 
-listen.owner = nginx +listen.owner = www-data 
-listen.group = nginx+listen.group = www-data
 listen.allowed_clients = 127.0.0.1 listen.allowed_clients = 127.0.0.1
  
Line 65: Line 67:
 php_value[max_file_uploads] = "100" php_value[max_file_uploads] = "100"
  
-php_value[session.save_handler] = files +php_value[session.save_handler] = "files" 
-php_value[session.save_path] = /var/lib/php/session +php_value[session.save_path] = "/var/lib/php/session" 
-php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache +php_value[soap.wsdl_cache_dir] = "/var/lib/php/wsdlcache" 
-php_value[opcache.file_cache] = /var/lib/php/opcache</code>+php_value[opcache.file_cache] = "/var/lib/php/opcache"</code>
  
 ===== FastCGI ===== ===== FastCGI =====
  
-  sudo -e '/etc/nginx/default.d/social.conf'+  sudo -e '/etc/nginx/snippets/social.conf'
  
 <code> <code>
Line 84: Line 86:
     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/social.sock;+    fastcgi_pass unix:/run/php/social.sock;
 }</code> }</code>
  
 ===== Server Block ===== ===== Server Block =====
  
-  sudo -e '/etc/nginx/conf.d/social.conf' && sudo systemctl reload 'nginx'+  sudo -e '/etc/nginx/sites-available/social.conf'
  
 <code> <code>
Line 98: Line 100:
     index 'index.php';     index 'index.php';
  
-    include '/etc/nginx/default.d/social.conf'; +    include '/etc/nginx/snippets/social.conf'; 
-    include '/etc/nginx/default.d/headers.conf';+    include '/etc/nginx/snippets/headers.conf';
  
     client_max_body_size '10M';     client_max_body_size '10M';
Line 125: Line 127:
     }     }
 }</code> }</code>
 +
 +==== Enable ====
 +
 +****
 +
 +  sudo rm -f '/etc/nginx/sites-enabled/social.conf' && sudo ln -s '/etc/nginx/sites-available/social.conf' '/etc/nginx/sites-enabled/social.conf' && sudo systemctl reload 'nginx' && sync
  
 ====== Initial Setup ====== ====== Initial Setup ======
Line 140: Line 148:
 <code> <code>
 [Service] [Service]
-User=nginx +User=www-data 
-Group=nginx+Group=www-data
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www/social WorkingDirectory=/var/www/social
 ExecStart='/usr/bin/php' '/var/www/social/bin/worker.php' ExecStart='/usr/bin/php' '/var/www/social/bin/worker.php'
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
  
   * Every 5 minutes   * Every 5 minutes
-  * :!: Refer to [[distros:fedora_server#selinux|SELinux notes]] to generate a profile for this 
  
   sudo -e '/etc/systemd/system/social-d.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-d.timer' --now   sudo -e '/etc/systemd/system/social-d.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-d.timer' --now
Line 170: Line 177:
  
 ==== Service ==== ==== Service ====
- 
-  * :!: Refer to [[distros:fedora_server#selinux|SELinux notes]] to generate a profile for this ((the composer step will likely be denied)) 
  
   sudo -e '/etc/systemd/system/social-up.service'   sudo -e '/etc/systemd/system/social-up.service'
Line 177: Line 182:
 <code> <code>
 [Service] [Service]
-User=nginx +User=www-data 
-Group=nginx+Group=www-data
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www/social WorkingDirectory=/var/www/social
Line 185: Line 190:
 ExecStart='/usr/bin/git' -C '/var/www/social/addon' pull origin 'master' ExecStart='/usr/bin/git' -C '/var/www/social/addon' pull origin 'master'
 ExecStart='/var/www/social/bin/composer.phar' install --no-dev ExecStart='/var/www/social/bin/composer.phar' install --no-dev
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 214: Line 219:
 <code> <code>
 [Service] [Service]
-User=nginx +User=www-data 
-Group=nginx+Group=www-data
 Type=oneshot Type=oneshot
 ExecStart='/usr/bin/git' -C '/var/www/social' gc --aggressive --prune='all' ExecStart='/usr/bin/git' -C '/var/www/social' gc --aggressive --prune='all'
Line 221: Line 226:
 ExecStart='/usr/bin/git' -C '/var/www/social/addon' gc --aggressive --prune='all' ExecStart='/usr/bin/git' -C '/var/www/social/addon' gc --aggressive --prune='all'
 ExecStart='/usr/bin/git' -C '/var/www/social/addon' fsck --full --strict ExecStart='/usr/bin/git' -C '/var/www/social/addon' fsck --full --strict
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 ==== Timer ==== ==== Timer ====
Line 254: Line 259:
 Type=oneshot Type=oneshot
 WorkingDirectory=/var/www WorkingDirectory=/var/www
-ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -cvzf "/home/CHANGEME/backups/friendica-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "social"' +ExecStart='/bin/bash' -c '"/bin/tar" -cvzf "/home/CHANGEME/backups/friendica-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" "social"' 
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 === Timer === === Timer ===
Line 294: Line 299:
 WorkingDirectory=/var/lib/mysql/tmp WorkingDirectory=/var/lib/mysql/tmp
 ExecStartPre='/usr/bin/mysqldump' --defaults-extra-file='/var/lib/mysql/auth/friendica' --single-transaction 'friendica' -r '/var/lib/mysql/tmp/friendica.sql' ExecStartPre='/usr/bin/mysqldump' --defaults-extra-file='/var/lib/mysql/auth/friendica' --single-transaction 'friendica' -r '/var/lib/mysql/tmp/friendica.sql'
-ExecStart='/usr/bin/gzip' -f '/var/lib/mysql/tmp/friendica.sql' +ExecStart='/bin/gzip' -f '/var/lib/mysql/tmp/friendica.sql' 
-ExecStart='/usr/bin/bash' -c '"/usr/bin/mv" "/var/lib/mysql/tmp/friendica.sql.gz" "/home/CHANGEME/backups/friendica-database-auto-"$$(date +%%Y-%%m-%%d)".sql.gz"' +ExecStart='/bin/bash' -c '"/bin/mv" "/var/lib/mysql/tmp/friendica.sql.gz" "/home/CHANGEME/backups/friendica-database-auto-"$$(date +%%Y-%%m-%%d)".sql.gz"' 
-ExecStartPost='/usr/bin/sync'</code>+ExecStartPost='/bin/sync'</code>
  
 === Timer === === Timer ===
Line 326: Line 331:
 **** ****
  
-  sudo systemctl stop nginx php-fpm+  sudo systemctl stop nginx php7.2-fpm
  
 ==== Backup Folder ==== ==== Backup Folder ====
Line 338: Line 343:
 **** ****
  
-  sudo -u 'mysql' mysqldump --defaults-extra-file='/var/lib/mysql/auth/friendica' --single-transaction 'friendica' -r ~/'friendica-database-manual-'$(date +%Y-%m-%d)'.sql' && sync+  sudo mysqldump --defaults-extra-file='/var/lib/mysql/auth/friendica' --single-transaction 'friendica' -r ~/'friendica-database-manual-'$(date +%Y-%m-%d)'.sql' && sync
  
 ==== Start Services ==== ==== Start Services ====
Line 344: Line 349:
 **** ****
  
-  sudo systemctl start nginx php-fpm+  sudo systemctl start nginx php7.2-fpm
  
 ===== Client ===== ===== Client =====
/var/www/wiki/data/pages/servers/nginx/friendica.txt · Last modified: 2024/02/01 08:29 by Sean Rhone