servers:nginx:friendica
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| servers:nginx:friendica [2023/09/12 14:43] – openSUSE TW -> Fedora Server (partial) Sean Rhone | servers:nginx:friendica [2024/08/13 22:20] (current) – removed Sean Rhone | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Information ====== | ||
| - | |||
| - | * Friendica ((https:// | ||
| - | * [[Information: | ||
| - | * https:// | ||
| - | |||
| - | ===== Prerequisites ===== | ||
| - | |||
| - | * [[distros: | ||
| - | * [[servers: | ||
| - | * [[servers: | ||
| - | * [[servers: | ||
| - | |||
| - | ====== Dependencies ====== | ||
| - | |||
| - | ===== Old openSUSE ===== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo zypper install php8-posix php8-gmp openssl php8-pcntl php8-xdebug | ||
| - | |||
| - | ====== Download Source ====== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo git clone --branch ' | ||
| - | |||
| - | ====== PHP Dependencies ====== | ||
| - | |||
| - | * [[https:// | ||
| - | |||
| - | sudo su ' | ||
| - | |||
| - | cd '/ | ||
| - | |||
| - | ====== Database ====== | ||
| - | |||
| - | sudo mysql | ||
| - | |||
| - | CREATE DATABASE friendica; | ||
| - | |||
| - | GRANT ALL PRIVILEGES ON friendica.* to ' | ||
| - | |||
| - | FLUSH PRIVILEGES; | ||
| - | |||
| - | EXIT | ||
| - | |||
| - | ====== nginx + PHP-FPM Configuration ====== | ||
| - | |||
| - | ===== PHP-FPM Socket ===== | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [social] | ||
| - | |||
| - | ; User/Group | ||
| - | user = nginx | ||
| - | group = nginx | ||
| - | |||
| - | ; Socket | ||
| - | listen = / | ||
| - | listen.acl_users = nginx | ||
| - | listen.allowed_clients = 127.0.0.1 | ||
| - | |||
| - | ; Process Management | ||
| - | pm = ondemand | ||
| - | pm.max_children = 4 | ||
| - | pm.process_idle_timeout = 30 | ||
| - | |||
| - | ; Fedora php.ini Defaults | ||
| - | php_value[session.save_handler] = " | ||
| - | php_value[session.save_path] = "/ | ||
| - | |||
| - | ; General | ||
| - | php_value[date.timezone] = " | ||
| - | php_value[max_execution_time] = " | ||
| - | php_value[memory_limit] = " | ||
| - | php_value[post_max_size] = " | ||
| - | php_value[upload_max_filesize] = " | ||
| - | php_value[max_file_uploads] = " | ||
| - | php_value[register_argc_argv] = " | ||
| - | php_value[upload_tmp_dir] = "/ | ||
| - | |||
| - | ; End</ | ||
| - | |||
| - | ===== FastCGI ===== | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | # PHP-FPM | ||
| - | location ~ \.(php|phar)(/ | ||
| - | fastcgi_split_path_info ^(.+\.(?: | ||
| - | fastcgi_intercept_errors on; | ||
| - | fastcgi_index index.php; | ||
| - | include fastcgi_params; | ||
| - | fastcgi_param SCRIPT_FILENAME | ||
| - | fastcgi_param PATH_INFO $fastcgi_path_info; | ||
| - | fastcgi_pass unix:/ | ||
| - | }</ | ||
| - | |||
| - | ==== Test ==== | ||
| - | |||
| - | < | ||
| - | # PHP-FPM | ||
| - | location ~* \.php$ { | ||
| - | # fastcgi_intercept_errors on; | ||
| - | # fastcgi_param PATH_INFO $fastcgi_path_info; | ||
| - | fastcgi_pass unix:/ | ||
| - | fastcgi_buffers 8 16k; | ||
| - | fastcgi_buffer_size 32k; | ||
| - | fastcgi_connect_timeout 60; | ||
| - | fastcgi_send_timeout 300; | ||
| - | fastcgi_read_timeout 300; | ||
| - | fastcgi_split_path_info ^(.+? | ||
| - | try_files $uri =404; | ||
| - | fastcgi_index index.php; | ||
| - | include fastcgi_params; | ||
| - | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| - | }</ | ||
| - | |||
| - | ===== Server Block ===== | ||
| - | |||
| - | * 2023/09/12: CSPs disabled; TODO: Re-figure out CSPs | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | server { | ||
| - | listen ' | ||
| - | server_name ' | ||
| - | root '/ | ||
| - | index ' | ||
| - | |||
| - | include '/ | ||
| - | include '/ | ||
| - | |||
| - | client_max_body_size ' | ||
| - | |||
| - | # add_header Content-Security-Policy " | ||
| - | |||
| - | # access_log | ||
| - | # error_log | ||
| - | |||
| - | location / { | ||
| - | try_files $uri / | ||
| - | } | ||
| - | |||
| - | location ^~ / | ||
| - | allow all; | ||
| - | rewrite ^ / | ||
| - | } | ||
| - | |||
| - | location ~* \.(tpl|md|tgz|log|out)$ { | ||
| - | deny all; | ||
| - | } | ||
| - | |||
| - | location ~ /\. { | ||
| - | deny all; | ||
| - | } | ||
| - | }</ | ||
| - | |||
| - | ====== Initial Setup ====== | ||
| - | |||
| - | ===== Initialize ===== | ||
| - | |||
| - | * :!: Change '' | ||
| - | |||
| - | sudo su ' | ||
| - | |||
| - | cd '/ | ||
| - | |||
| - | ===== Website ===== | ||
| - | |||
| - | * https:// | ||
| - | * :!: Be sure the email matches what was used on the above command | ||
| - | |||
| - | ===== User ===== | ||
| - | |||
| - | * :!: '' | ||
| - | |||
| - | sudo su ' | ||
| - | |||
| - | cd '/ | ||
| - | |||
| - | ====== Settings ====== | ||
| - | |||
| - | ===== frio Theme ===== | ||
| - | |||
| - | * Navigation bar background color: '' | ||
| - | * Navigation bar icon color: '' | ||
| - | * Link color: '' | ||
| - | * Set the background color: '' | ||
| - | * Login page background color: '' | ||
| - | |||
| - | * Copy or paste schemestring: | ||
| - | |||
| - | < | ||
| - | |||
| - | ====== Services ====== | ||
| - | |||
| - | ===== Worker ===== | ||
| - | |||
| - | ==== Service ==== | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Service] | ||
| - | User=nginx | ||
| - | Group=nginx | ||
| - | Type=oneshot | ||
| - | WorkingDirectory=/ | ||
| - | ExecStart='/ | ||
| - | ExecStartPost='/ | ||
| - | |||
| - | ==== Timer ==== | ||
| - | |||
| - | * Every 5 minutes | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Unit] | ||
| - | Description=friendica Worker Daemon | ||
| - | After=network-online.target | ||
| - | Wants=network-online.target | ||
| - | |||
| - | [Timer] | ||
| - | OnBootSec=5m | ||
| - | OnUnitActiveSec=5m | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target</ | ||
| - | |||
| - | ==== SELinux Test ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo semanage fcontext --add --type ' | ||
| - | |||
| - | ===== Updater ===== | ||
| - | |||
| - | ==== Service ==== | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Service] | ||
| - | User=nginx | ||
| - | Group=nginx | ||
| - | Type=oneshot | ||
| - | WorkingDirectory=/ | ||
| - | Environment=" | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStartPost='/ | ||
| - | |||
| - | ==== Timer ==== | ||
| - | |||
| - | * Every day at '' | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Unit] | ||
| - | Description=friendica Updater | ||
| - | After=network-online.target | ||
| - | Wants=network-online.target | ||
| - | |||
| - | [Timer] | ||
| - | OnCalendar=*-*-* 02:00:00 | ||
| - | Persistent=true | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target</ | ||
| - | |||
| - | ===== Maintenance ===== | ||
| - | |||
| - | ==== Service ==== | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Service] | ||
| - | User=nginx | ||
| - | Group=nginx | ||
| - | Type=oneshot | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStartPost='/ | ||
| - | |||
| - | ==== Timer ==== | ||
| - | |||
| - | * '' | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Unit] | ||
| - | Description=friendica Maintenance | ||
| - | After=network-online.target | ||
| - | Wants=network-online.target | ||
| - | |||
| - | [Timer] | ||
| - | OnCalendar=*-*-01 02:20:00 | ||
| - | Persistent=true | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target</ | ||
| - | |||
| - | ===== Backup ===== | ||
| - | |||
| - | ==== Files ==== | ||
| - | |||
| - | === Service === | ||
| - | |||
| - | mkdir -p ~/' | ||
| - | |||
| - | < | ||
| - | [Service] | ||
| - | Type=oneshot | ||
| - | WorkingDirectory=/ | ||
| - | ExecStart='/ | ||
| - | ExecStartPost='/ | ||
| - | |||
| - | === Timer === | ||
| - | |||
| - | * '' | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Unit] | ||
| - | Description=friendica Files Backup | ||
| - | |||
| - | [Timer] | ||
| - | OnCalendar=*-*-01 02:50:00 | ||
| - | Persistent=true | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target</ | ||
| - | |||
| - | ==== Database ==== | ||
| - | |||
| - | === Database Auth === | ||
| - | |||
| - | sudo mkdir -p '/ | ||
| - | |||
| - | < | ||
| - | [mysqldump] | ||
| - | user=friendica | ||
| - | password=x</ | ||
| - | |||
| - | === Service === | ||
| - | |||
| - | mkdir -p ~/' | ||
| - | |||
| - | < | ||
| - | [Service] | ||
| - | Type=oneshot | ||
| - | WorkingDirectory=/ | ||
| - | ExecStartPre='/ | ||
| - | ExecStart='/ | ||
| - | ExecStart='/ | ||
| - | ExecStartPost='/ | ||
| - | |||
| - | === Timer === | ||
| - | |||
| - | * Every day at '' | ||
| - | |||
| - | sudo -e '/ | ||
| - | |||
| - | < | ||
| - | [Unit] | ||
| - | Description=friendica Database Backup | ||
| - | After=mariadb.service | ||
| - | |||
| - | [Timer] | ||
| - | OnCalendar=*-*-* 02:15:00 | ||
| - | Persistent=true | ||
| - | |||
| - | [Install] | ||
| - | WantedBy=timers.target</ | ||
| - | |||
| - | ====== Backup ====== | ||
| - | |||
| - | * Create backup archive on server and transfer to client computer | ||
| - | |||
| - | ===== Server ===== | ||
| - | |||
| - | ==== Stop Services ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo systemctl stop nginx php-fpm | ||
| - | |||
| - | ==== Backup Folder ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | cd '/ | ||
| - | |||
| - | ==== Backup Database ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo mysqldump --defaults-extra-file='/ | ||
| - | |||
| - | ==== Start Services ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo systemctl start nginx php-fpm | ||
| - | |||
| - | ===== Client ===== | ||
| - | |||
| - | ==== Transfer Files To Client ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | scp espionage724@192.168.1.152: | ||
| - | |||
| - | ====== Restore ====== | ||
| - | |||
| - | ===== Client ===== | ||
| - | |||
| - | ==== Uncompress Database ==== | ||
| - | |||
| - | * This is only needed if restoring an **automated** database backup ((manual doesn' | ||
| - | |||
| - | gunzip ~/' | ||
| - | |||
| - | ==== Transfer Files To Server ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | scp ~/' | ||
| - | |||
| - | ==== Remove Files ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | rm -f ~/' | ||
| - | |||
| - | ===== Server ===== | ||
| - | |||
| - | ==== Stop Services ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo systemctl stop nginx php-fpm | ||
| - | |||
| - | ==== Remove Previous Folder ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo rm -Rf '/ | ||
| - | |||
| - | ==== Restore Friendica Folder ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | cd '/ | ||
| - | |||
| - | ==== Drop Previous Database ==== | ||
| - | |||
| - | sudo mysql | ||
| - | |||
| - | DROP DATABASE friendica; | ||
| - | |||
| - | FLUSH TABLES; | ||
| - | |||
| - | EXIT | ||
| - | |||
| - | ==== Re-create Databases ==== | ||
| - | |||
| - | sudo mysql | ||
| - | |||
| - | CREATE DATABASE friendica; | ||
| - | |||
| - | EXIT | ||
| - | |||
| - | ==== Restore Database ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo mysql ' | ||
| - | |||
| - | ==== Reapply Permissions ==== | ||
| - | |||
| - | sudo mysql | ||
| - | |||
| - | GRANT ALL PRIVILEGES ON friendica.* to ' | ||
| - | |||
| - | FLUSH PRIVILEGES; | ||
| - | |||
| - | EXIT | ||
| - | |||
| - | ==== Start Services ==== | ||
| - | |||
| - | **** | ||
| - | |||
| - | sudo systemctl start nginx php-fpm | ||
| - | |||
| - | ==== Remove Backups ==== | ||
| - | |||
| - | * Verify that Friendica works before running | ||
| - | |||
| - | rm ~/' | ||
/usr/local/www/wiki/data/attic/servers/nginx/friendica.1694544205.txt.gz · Last modified: (external edit)
