diff --git a/05_php_addressbook.md b/05_php_addressbook.md new file mode 100644 index 0000000..ea4ffb4 --- /dev/null +++ b/05_php_addressbook.md @@ -0,0 +1,99 @@ +# Enable PHP in Nginx + +run in bash: + +```bash +sudo apt install php-fpm -y +``` + +get php version/sock + +```bash +ls -l /run/php/*.sock +``` + +add to nginx config (server section): + +```nginx +# pass PHP scripts to FastCGI server +# +location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.4-fpm.sock; # <-- use version from output above! +} +``` + +validate nginx configuration & restart if ok: + +```bash +sudo nginx -t +sudo systemctl reload nginx +``` + +create Demo-App: + +```bash +sudo vi /var/www/*domain-name*/*webapp*.php +``` + +## Demo Webapp (Addressbook) + +```php + + + + + + Demo: Addressbook + + + +

Einfaches Adressbuch

+ +
+ + +
+ +
+ +

Einträge:

+ +
+ Benutzer: +
+ + +

Liste leeren

+ + + + +``` + +create txt file (as database): + +```bash +cd /var/www/*domain-name* +sudo touch names.txt +sudo chown www-data:www-data names.txt +sudo chown www-data:www-data *webapp* +``` + +testing the webapp: + +``` +http://*domain-name*/*webapp*.php +``` + diff --git a/images/get_csp_hash.png b/images/get_csp_hash.png new file mode 100644 index 0000000..356c3b9 Binary files /dev/null and b/images/get_csp_hash.png differ