Installation

WebServer

sudo apt install nginx php php-cgi php-cli php-fpm php-imagick php-sqlite3 imagemagick lm-sensors mariadb-server mariadb-client phpmyadmin zip sshpass librsvg2-2 librsvg2-bin librsvg2-dev composer libimage-exiftool-perl rust-all

sudo apt purge apache2
sudo apt autoremove

/etc/php/8.1/fpm/php.ini

Eintragen:
date.timezone = Europe/Berlin

Ändern:
max_execution_time = 300
error_reporting = E_ALL
display_startup_errors = On
post_max_size = 256M
upload_max_filesize = 256M

/etc/nginx/nginx.conf

http {
	...
	server_names_hash_bucket_size 64;
	...

	##
	# Gzip Settings
	##

	gzip on;

	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;
	gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# PHP Handler
	##
	upstream php {
		server unix:/run/php/php8.3-fpm.sock;
	}
	...
}

MYSql

sudo mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
exit

Datei neu anlegen

/etc/nginx/conf.d/php

location ~ \.php$ {
	fastcgi_pass php;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
	fastcgi_read_timeout 86400;

	include fastcgi_params;
}

Datei neu anlegen

/etc/nginx/conf.d/phpmyadmin

location /phpmyadmin {
	root /usr/share;
	index index.php index.html;

	include conf.d/php;
}

/etc/nginx/sites-enabled/default

# Projects server configuration
# Vorhandene Einträge komplett ersetzen in default!

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/PhpMapCreateProjects;

	index index.php index.html;

	server_name _;

	client_max_body_size 1024M;

	rewrite "^(/api/(.+))" /src/api.php?path=$1 last;

	location / {
		try_files $uri $uri/ =404;
	}

	include conf.d/php;
	include conf.d/phpmyadmin;
}

nginx Server neustarten

sudo service nginx restart

SSH Key für Repository erstellen

ssh-keygen -t ed25519
SSH Key bei Bitbucket hinterlegen
Workspace Settings -> SSH Schlüssel
SChlüssel hinzufügen
Label = "216 (serverconnect 24.04)"
Key = Text aus der Datei /serverconnect/.ssh/id_ed25519.pub kopieren

Repository

mkdir projects
cd projects
git clone git@bitbucket.org:locr/phpmapcreateprojects.git PhpMapCreateProjects

cd PhpMapCreateProjects
git submodule update --init --recursive

cd libraries/locr-php/
composer install
cd ../..
composer install

cd /var/www
sudo ln -s ~/projects/PhpMapCreateProjects .
sudo chmod +rx /home/serverconnect
sudo mkdir -p /var/www/project_files
sudo chown -R www-data:www-data /var/www/project_files

/etc/project-server.ini anlegen

[DB]
username = root
password = <password>

[FS]
;projects_path = <path-to-project-files>

[ICON_SERVER]
base_url = https://icons.locr.com/
auth_username = <username>
auth_password = <password>
ssl_verifyhost = 2
ssl_verifypeer = "true"

/var/www/maps_server.ini anlegen

[project_server]
ROOT_DB_PASSWORD=1gd...

Datenbank von BackUP wiederherstellen

#Einmal Verbindung herstellen
ssh 192.168.100.250

cd /var/www/PhpMapCreateProjects/cronjobs
./restore_projects.sh --host=192.168.100.250 --username=backup --mysql-password=1gd2... --zip-password=1gd... --password=1gd... --remote-backup-directory=BackUp_Projekte --remote-sub-directory=216

LOG-Datei anlegen

sudo touch /var/log/locr.log
sudo chown www-data:www-data /var/log/locr.log

Cronjobs

0 1 * * * wget http://localhost/delete_expired_projects.php --output-document=delete_expired_projects.log
0 2 * * * cd /var/www/PhpMapCreateProjects/cronjobs && ./backup_projects.sh --host=192.168.100.250 --username=backup --mysql-password=1gd... --zip-password=1gd... --password=1gd... --remote-backup-directory=BackUp_Projekte --remote-sub-directory=215
0 3 * * * cd /var/www/PhpMapCreateProjects/cronjobs && ./gdpr_cleanup.php