설치된 서비스
- Nginx 웹 서버 →
/var/www/html - MySQL 서버(보안 적용) → 루트 자격 증명 저장 위치
/root/.cloudzy-creds - PHP & Extensions → 포함
php-fpm,php-mysql,php-cli,php-curl,php-mbstring,php-xml,php-zip,php-gd
중요한 파일 및 디렉토리
- 저장된 MySQL root 비밀번호:
/root/.cloudzy-creds - Nginx 웹 루트 디렉토리:
/var/www/html - Nginx 설정 파일:
/etc/nginx - MySQL 설정 파일:
/etc/mysql - MySQL 데이터베이스 파일:
/var/lib/mysql - Nginx 로그:
/var/log/nginx - MySQL 로그:
/var/log/mysql - PHP-FPM 소켓:
/run/php/php-fpm.sock
MySQL에 액세스
루트로 로그인:
mysql -u root -p
비밀번호가 저장되어 있습니다 /root/.cloudzy-creds.
일반적인 명령어:
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
Nginx 접속
웹 루트: /var/www/html
설정 테스트:
sudo nginx -t
브라우저에서 액세스: http://<SERVER_IP>
PHP 사용
버전 확인:
php -v
서비스 관리
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}