- composer apache2 mariadb-server mariadb-client php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc
- adduser drupal
- usermod -aG www-data drupal
Create New Site
- nginx-drupal-proxy
- SITEDOMAIN=
- vim /etc/apache2/sites-available/$SITEDOMAIN.conf
- a2ensite $SITEDOMAIN.conf
- systemctl reload apache2
- su drupal
- https://www.drupal.org/project/drupal/releases/10.0.0
- composer create-project drupal/recommended-project:^10 DIRNAME
- cd DIRNAME
- mkdir web/sites/default/files
- chmod 777 web/sites/default/files
- cp web/sites/default/default.settings.php web/sites/default/settings.php
- cp web/sites/example.sites.php web/sites/sites.php
- mkdir -p web/sites/$SITEDOMAIN/files
- cp web/sites/default/default.settings.php web/sites/$SITEDOMAIN/settings.php
- chmod 777 web/sites/$SITEDOMAIN/files
- chmod 777 web/sites/$SITEDOMAIN/settings.php
- chmod 755 web/sites/$SITEDOMAIN/settings.php
Create DataBase
- mysql -u root -p
- CREATE DATABASE DBNAME
- CREATE USER 'USER'@'localhost' IDENTIFIED BY 'PW';
- GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON DB.* TO 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';
settings.php
Backslash vor punkt!
$settings['trusted_host_patterns'] = [
'wiki\.bubuit\.net$',
];
reverse proxy
$settings['reverse_proxy'] = TRUE;
$settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
Symfony
$settings['reverse_proxy_trusted_headers'] = \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_FOR | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_HOST | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PORT | \Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_PROTO | \Symfony\Component\HttpFoundation\Request::HEADER_FORWARDED;
Setting the MySQL transaction isolation level
to the database connection array
'init_commands' => [
'isolation_level' => 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
],
Private file system settings
$settings['file_private_path'] = $app_root . '/../private';
Errors
In case that your test of the private file system path failed and that you get the following errors:
Not fully protected
See https://www.drupal.org/SA-CORE-2013-003 for information about the recommended .htaccess file which should be added to the private:// directory to help protect against arbitrary code execution.
Your private:// stream is not configured.
These errors are triggered because your private directory was not created prior to setting the variable $settings['file_private_path'].
To resolve this issue:
- Run cron from Configuration > Cron.
- Clear your cache from Configuration > Performance.
private/.htaccess
# Turn off all options we don't need.
Options None
Options +FollowSymLinks
# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>
# Deny all requests from Apache 2.4+.
Require all denied
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews
# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
# Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
# If we know how to do it safely, disable the PHP engine entirely.
php_flag engine off
Restore DB Backup
ll /var/backups/automysqlbackup/daily/
extract /var/backups/automysqlbackup/daily/DBNAME/DBNAME_2023-01-24_06h25m.Tuesday.sql.bz2
mysql -u root -p DBNAME < /var/backups/automysqlbackup/daily/DBNAME/DBNAME_2023-01-24_06h25m.Tuesday.sql