Installerede tjenester
- Nginx-webserver →
/var/www/html - MySQL Server (sikret) → Root-legitimationsoplysninger gemt på
/root/.cloudzy-creds - PHP & udvidelser → Inkluderer
php-fpm,php-mysql,php-cli,php-curl,php-mbstring,php-xml,php-zip,php-gd
Vigtige filer og mapper
- Gemte MySQL-root-adgangskode:
/root/.cloudzy-creds - Nginx-webrodmappe:
/var/www/html - Nginx-konfigurationsfiler:
/etc/nginx - MySQL-konfigurationsfiler:
/etc/mysql - MySQL-databasefiler:
/var/lib/mysql - Nginx-logfiler:
/var/log/nginx - MySQL-logfiler:
/var/log/mysql - PHP-FPM-socket:
/run/php/php-fpm.sock
Adgang til MySQL
Log ind som root:
mysql -u root -p
Adgangskoden gemmes i /root/.cloudzy-creds.
Almindelige kommandoer:
SHOW DATABASES; -- List all databases
USE <database>; -- Switch to a specific database
CREATE DATABASE mydb; -- Create a new database
CREATE USER 'appuser'@'localhost' IDENTIFIED BY 'password'; -- Create a new user
GRANT ALL PRIVILEGES ON mydb.* TO 'appuser'@'localhost'; -- Grant privileges
EXIT; -- Quit MySQL shell
Adgang til Nginx
Webrod: /var/www/html
Konfigurationstest:
sudo nginx -t
Adgang i browser: http://<SERVER_IP>
Brug PHP
Kontroller version:
php -v
Servicestyring
Nginx:
sudo systemctl status nginx # Check status
sudo systemctl restart nginx # Restart service
MySQL:
sudo systemctl status mysql # Check status
sudo systemctl restart mysql # Restart service
PHP-FPM:
PHP_FPM_VERSION=$(ls /etc/php | grep -E '^[0-9]+.[0-9]+$')
PHP_FPM_SERVICE="php${PHP_FPM_VERSION}-fpm"
systemctl status ${PHP_FPM_SERVICE}
systemctl restart ${PHP_FPM_SERVICE}