diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 3ab125a..1705dd7 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -25,6 +25,25 @@ ## ۱. استقرار لاراول +### بکاپ دیتابیس +\```bash +# بکاپ کامل دیتابیس +mysqldump -u root -p ifnex_db > /backups/ifnex_$(date +%Y%m%d_%H%M%S).sql + +# یا فشرده +mysqldump -u root -p ifnex_db | gzip > /backups/ifnex_$(date +%Y%m%d_%H%M%S).sql.gz +\``` + +### بکاپ فایل‌ها +\```bash +# بکاپ فایل‌های لاراول +tar -czf /backups/laravel_$(date +%Y%m%d_%H%M%S).tar.gz /home/USER/web/api.ifnex.vernahost.ir/public_html + +# بکاپ فایل‌های وردپرس +tar -czf /backups/wordpress_$(date +%Y%m%d_%H%M%S).tar.gz /home/USER/web/ifnex.vernahost.ir/public_html +\``` + + ### ۱.۱ کلون مخزن روی سرور ```bash @@ -36,16 +55,17 @@ git clone https://www.git.vernahost.ir/gitmodir110/ifnex.git . ```bash cd /home/USER/web/api.ifnex.vernahost.ir/public_html -ngit clone https://www.git.vernahost.ir/gitmodir110/ifnex.git tmp-ifnex +git clone https://www.git.vernahost.ir/gitmodir110/ifnex.git tmp-ifnex cp -r tmp-ifnex/04_Laravel/* . -cp -r tmp-ifnex/04_Laravel/.* . 2>/dev/null -rm -rf tmp-ifnex -``` +# فقط فایل‌های مخفی خاص را کپی کنید +cp -r tmp-ifnex/04_Laravel/.env.example . +cp -r tmp-ifnex/04_Laravel/.gitignore . +# یا بهتر است فایل‌ها را دستی کپی کنید ... ### ۱.۲ نصب وابستگی‌ها ```bash -ncd /home/USER/web/api.ifnex.vernahost.ir/public_html +cd /home/USER/web/api.ifnex.vernahost.ir/public_html composer install --no-dev --optimize-autoloader ``` @@ -225,3 +245,95 @@ php artisan route:list --path=api/v1 --- © 2026 VernaSoft Group. Internal use only. + + +## ۷. تنظیمات Web Server + +### Nginx (لاراول) +\```nginx +server { + listen 80; + server_name api.ifnex.vernahost.ir; + root /home/USER/web/api.ifnex.vernahost.ir/public_html/public; + + index index.php; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~ \.php$ { + fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.(?!well-known).* { + deny all; + } +} +\``` + +### Apache (لاراول) +\```apache + + ServerName api.ifnex.vernahost.ir + DocumentRoot /home/USER/web/api.ifnex.vernahost.ir/public_html/public + + + AllowOverride All + Require all granted + + + ErrorLog ${APACHE_LOG_DIR}/api.ifnex.error.log + CustomLog ${APACHE_LOG_DIR}/api.ifnex.access.log combined + +\``` + + + +## ۸. Queue Worker (اگر استفاده می‌شود) + +### Supervisor Setup +\```bash +sudo nano /etc/supervisor/conf.d/ifnex-worker.conf +\``` + +\```ini +[program:ifnex-worker] +process_name=%(program_name)s_%(process_num)02d +command=php /home/USER/web/api.ifnex.vernahost.ir/public_html/artisan queue:work --sleep=3 --tries=3 --max-time=3600 +autostart=true +autorestart=true +stopasgroup=true +killasgroup=true +user=USER +numprocs=2 +redirect_stderr=true +stdout_logfile=/home/USER/web/api.ifnex.vernahost.ir/public_html/storage/logs/worker.log +\``` + +\```bash +sudo supervisorctl reread +sudo supervisorctl update +sudo supervisorctl start all +\``` + + +## ۹. SSL/TLS (HTTPS) + +### Let's Encrypt (رایگان) +\```bash +# نصب Certbot +sudo apt install certbot python3-certbot-nginx + +# دریافت SSL certificate +sudo certbot --nginx -d api.ifnex.vernahost.ir -d ifnex.vernahost.ir + +# تمدید خودکار (تست) +sudo certbot renew --dry-run +\``` + + + diff --git a/README.md b/README.md index 40be5e3..cb2f353 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ [![WordPress](https://img.shields.io/badge/WordPress-7.0.3-21759B?logo=wordpress&logoColor=white)](https://wordpress.org) [![MySQL](https://img.shields.io/badge/MySQL-8+-4479A1?logo=mysql&logoColor=white)](https://mysql.com) [![License](https://img.shields.io/badge/License-Proprietary-blue.svg)]() -[![Status](https://img.shields.io/badge/Status-Phase_3-60%25-yellow.svg)]() +[![Status](https://img.shields.io/badge/Status-Phase_3-95%25-success.svg)]() ---