🚀 오라클 클라우드에 워드프레스 자동 설치하기
안녕하세요! 이번에는 제가 개발한 워드프레스 자동 설치 스크립트를 소개해 드릴게요. 이 스크립트 하나로 오라클 클라우드 인스턴스에 워드프레스를 쉽고 빠르게 설치할 수 있답니다!
✨ 스크립트 주요 기능
이 스크립트는 다음과 같은 기능을 자동으로 수행합니다:
🔄 시스템 업데이트 및 기본 설정
- 시스템 패키지 업데이트
- 한국 시간대(Asia/Seoul) 설정
- 기본 방화벽 설정(SSH, HTTP, HTTPS)
💾 메모리 최적화
- 4GB 스왑 메모리 설정 (오라클 무료 인스턴스의 부족한 RAM 보완)
- PHP 메모리 설정 최적화
📦 필수 소프트웨어 설치
- MariaDB(MySQL) 데이터베이스
- Nginx 웹 서버
- PHP 8.2 및 필수 확장 모듈
- 워드프레스 최신 버전
- Certbot(SSL 인증서)
🔄 DDNS 설정 (선택 사항)
- Cloudflare DDNS 지원
🛡️ 보안 설정
- MariaDB 보안 설정
- 워드프레스 보안 키 자동 생성
- 적절한 파일 권한 설정
📋 사용 방법
준비물
- 오라클 클라우드 인스턴스 (Ubuntu 서버 권장)
- 도메인 이름 (가비아, 후이즈 등에서 구매)
- SSH로 서버에 접속할 수 있는 환경
설치 단계
스크립트 다운로드
SSH로 서버에 접속한 후 다음 명령어를 실행합니다:
wget https://raw.githubusercontent.com/kimvayne/wordpress/main/wordpress-setup.sh chmod +x wordpress-setup.sh
스크립트 실행
sudo ./wordpress-setup.sh
필요한 정보 입력
스크립트가 실행되면 다음 정보를 입력해야 합니다:
- 도메인 이름 (예: example.com)
- 데이터베이스 이름
- 데이터베이스 사용자 이름
- 데이터베이스 비밀번호
- DDNS 사용 여부 및 관련 정보
설치 완료 후 SSL 인증서 발급
설치가 완료된 후, DNS 설정이 제대로 되었다면 다음 명령어로 SSL 인증서를 발급받으세요:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
워드프레스 설정 완료
웹 브라우저에서
https://yourdomain.com
에 접속하여 워드프레스 초기 설정을 완료하세요!
⚙️ 주요 설정 내용
PHP 최적화 설정
이 스크립트는 워드프레스가 원활하게 작동할 수 있도록 PHP를 다음과 같이 최적화합니다:
- memory_limit = 2048M: PHP가 사용할 수 있는 메모리 한도
- upload_max_filesize = 100M: 업로드 가능한 최대 파일 크기
- post_max_size = 101M: POST 요청의 최대 크기
- max_execution_time = 360: 스크립트 실행 최대 시간(초)
워드프레스 설정
워드프레스도 다음과 같이 최적화됩니다:
- WP_MEMORY_LIMIT = 1024M: 워드프레스가 사용할 수 있는 메모리 한도
- 보안 키 자동 생성
- 파일 권한 최적화
Nginx 설정
Nginx 설정은 다음과 같은 최적화를 포함합니다:
- 정적 파일(이미지, CSS, JS 등)에 대한 캐싱 설정
- 클라이언트 요청 크기 제한 증가(100M)
- WordPress REST API 지원
- 보안 관련 설정
🚨 주의사항
- 백업: 기존 서버에 설치할 경우 항상 백업을 먼저 진행하세요.
- 도메인 설정: 스크립트 실행 전 도메인의 DNS 설정을 먼저 완료하는 것이 좋습니다.
- 방화벽: 스크립트는 자동으로 방화벽을 설정하지만, 클라우드 콘솔에서도 포트가 열려있는지 확인하세요.
- Cloudflare 사용 시: SSL 인증서 발급 시 일시적으로 프록시 모드를 비활성화(DNS-only)하는 것이 좋습니다.
🔄 자주 발생하는 문제 해결
메모리 부족 오류
플러그인 설치나 업데이트 중 메모리 부족 오류가 발생한다면:
wp-config.php 확인:
define('WP_MEMORY_LIMIT', '1024M');
PHP 설정 확인:
sudo nano /etc/php/8.2/fpm/php.ini # memory_limit = 2048M 설정 확인 sudo systemctl restart php8.2-fpm
권한 문제
업로드나 업데이트 시 권한 문제가 발생한다면:
sudo chown -R www-data:www-data /var/www/wordpress/
sudo chmod -R 755 /var/www/wordpress/
📝 맺음말
이 스크립트를 사용하면 복잡한 워드프레스 설치 과정을 자동화하여 시간을 절약할 수 있습니다. 특히 오라클 클라우드의 무료 인스턴스처럼 메모리가 제한된 환경에서도 최적의 설정으로 워드프레스를 운영할 수 있도록 해줍니다.
궁금한 점이나 개선사항이 있으시면 댓글로 알려주세요! 여러분의 피드백을 바탕으로 스크립트를 계속 발전시켜 나가겠습니다. 😊
행복한 블로깅 되세요! 🚀
🚀 Automatically Installing WordPress on Oracle Cloud
Hello there! Today I’m excited to introduce my WordPress automatic installation script that makes setting up WordPress on Oracle Cloud instances quick and painless!
✨ Key Features of the Script
This script automatically performs the following functions:
🔄 System Updates and Basic Configuration
- System package updates
- Timezone setting (Asia/Seoul by default)
- Basic firewall configuration (SSH, HTTP, HTTPS)
💾 Memory Optimization
- 4GB swap memory setup (compensates for limited RAM on Oracle free instances)
- PHP memory settings optimization
📦 Essential Software Installation
- MariaDB (MySQL) database
- Nginx web server
- PHP 8.2 and required extensions
- Latest WordPress version
- Certbot (for SSL certificates)
🔄 DDNS Configuration (optional)
- Cloudflare DDNS support
🛡️ Security Settings
- MariaDB security configuration
- Automatic WordPress security keys generation
- Proper file permissions
📋 How to Use
Prerequisites
- Oracle Cloud instance (Ubuntu server recommended)
- A domain name (purchased from any domain registrar)
- SSH access to your server
Installation Steps
Download the Script
After connecting to your server via SSH, run these commands:
wget https://raw.githubusercontent.com/yourusername/wordpress-script/main/wordpress-install.sh chmod +x wordpress-install.sh
Run the Script
sudo ./wordpress-install.sh
Enter Required Information
When prompted, you’ll need to enter:
- Domain name (e.g., example.com)
- Database name
- Database username
- Database password
- Whether to use DDNS and related information
Install SSL Certificate After Setup
Once installation is complete and DNS settings are properly configured, issue an SSL certificate:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Complete WordPress Setup
Visit
https://yourdomain.com
in your web browser to complete the WordPress initial setup!
⚙️ Key Configuration Details
PHP Optimization
The script optimizes PHP for WordPress with these settings:
- memory_limit = 2048M: Maximum memory PHP can use
- upload_max_filesize = 100M: Maximum file upload size
- post_max_size = 101M: Maximum POST request size
- max_execution_time = 360: Maximum script execution time in seconds
WordPress Configuration
WordPress is optimized with:
- WP_MEMORY_LIMIT = 1024M: Maximum memory WordPress can use
- Automatic security keys generation
- Optimized file permissions
Nginx Configuration
The Nginx configuration includes:
- Caching settings for static files (images, CSS, JS, etc.)
- Increased client request size limit (100M)
- WordPress REST API support
- Security-related settings
🚨 Important Considerations
- Backup: Always create backups before installing on an existing server.
- Domain Setup: It’s best to complete your domain’s DNS configuration before running the script.
- Firewall: While the script configures the server firewall, verify port settings in your cloud console as well.
- Cloudflare Users: When issuing SSL certificates, temporarily switch to DNS-only mode (disable proxy).
🔄 Troubleshooting Common Issues
Memory Issues
If you encounter memory errors during plugin installation or updates:
Check wp-config.php:
define('WP_MEMORY_LIMIT', '1024M');
Verify PHP Settings:
sudo nano /etc/php/8.2/fpm/php.ini # Ensure memory_limit = 2048M sudo systemctl restart php8.2-fpm
Permission Problems
If you have upload or update permission issues:
sudo chown -R www-data:www-data /var/www/wordpress/
sudo chmod -R 755 /var/www/wordpress/
📝 Conclusion
This script automates the complex WordPress installation process, saving you time and effort. It’s particularly useful for memory-constrained environments like Oracle Cloud’s free instances, ensuring WordPress runs with optimal settings.
If you have questions or suggestions for improvements, please let me know in the comments! Your feedback helps me continue to enhance this script. 😊
Happy blogging! 🚀