Skip to content

Conversation

@ka215
Copy link
Owner

@ka215 ka215 commented Nov 13, 2025

📋 Summary

This PR adds comprehensive deployment documentation and configuration for hosting MockAPI-PHP in production environments, establishing subdirectory installation as the standard deployment method.

🎯 Changes

New Files

  • DEPLOYMENT.md (549 lines) - Comprehensive deployment guide

    • Apache deployment with subdirectory installation (recommended)
    • Document root installation guide
    • Nginx configuration examples
    • Environment configuration
    • Detailed troubleshooting section
  • .htaccess.sample (37 lines) - Apache URL rewriting configuration

    • Designed for parent directory placement
    • Detailed comments and usage instructions
    • Directory structure examples
  • .github/copilot-instructions.md (307 lines) - GitHub Copilot project instructions

    • Project context and coding standards
    • Common patterns and best practices
    • Helper functions and templates

Updated Files

  • CHANGELOG.md - Added v1.3.2 release notes
  • .gitignore - Exclude user-specific .htaccess files
  • README.md / README_JP.md - Added deployment guide references
  • version.json - Bumped to v1.3.2

📊 Statistics

```
8 files changed, 926 insertions(+), 2 deletions(-)
```

🎨 Key Features

Subdirectory Installation (Standard Method)

Directory Structure:
```
/var/www/html/ # Document root
├── .htaccess # ← Copy .htaccess.sample here
├── index.html # Existing site files
└── MockAPI-PHP/ # ← Git cloned directory
├── index.php
├── .htaccess.sample
└── ...
```

URL Structure:
```
https://example.com/MockAPI-PHP/api/users
↓ ↓ ↓
Directory BASE Endpoint
```

Benefits

  • ✅ Clean separation from main site
  • ✅ Easy updates via `git pull`
  • ✅ Multiple instances on same server
  • ✅ Standard deployment pattern

🔧 Technical Details

Apache Configuration

  • URL rewriting handled by parent directory `.htaccess`
  • Simplified RewriteRule for subdirectory routing
  • Excludes existing files and directories

Nginx Support

  • Complete configuration examples
  • Subdirectory and root installation patterns
  • Security configurations

Environment Variables

  • Clarified distinction between subdirectory path and `BASE_PATH`
  • `BASE_PATH` is API endpoint prefix (default: `/api`)
  • Works same way for both subdirectory and root installations

📚 Documentation Improvements

  • Visual directory structure diagrams
  • Step-by-step installation guides
  • Comprehensive troubleshooting section
  • Security recommendations
  • Performance optimization tips

🧪 Testing

Tested configurations:

  • Apache subdirectory installation
  • Apache document root installation
  • Nginx subdirectory installation
  • Nginx document root installation
  • URL rewriting
  • CORS headers
  • File permissions

🔗 Related Issues

Addresses common deployment questions and provides solutions for hosted environment installations.

📝 Checklist

  • Code follows PSR-12 standards
  • Documentation updated (README, DEPLOYMENT.md)
  • CHANGELOG.md updated
  • Version bumped to 1.3.2
  • .gitignore updated
  • Tested on Apache environment
  • Tested on Nginx environment

🚀 Breaking Changes

None. This is a backward-compatible addition of deployment documentation and configuration.

📖 Migration Guide

For existing users:

  1. No changes needed for local development
  2. For production deployment, follow the new `DEPLOYMENT.md` guide
  3. Copy `.htaccess.sample` to parent directory if using Apache

Ready to merge after review

Major improvements:
- Add DEPLOYMENT.md with detailed Apache/Nginx deployment instructions
- Add .htaccess.sample for subdirectory installation (standard method)
- Add GitHub Copilot instructions for better AI-assisted development
- Update .gitignore to exclude user-specific .htaccess files
- Enhance README files with deployment guide references
- Update to version 1.3.2

This update establishes subdirectory installation as the standard deployment
method, providing clear instructions for production environments.

Key features:
- Subdirectory installation with parent directory .htaccess placement
- Document root installation guide
- Apache and Nginx configuration examples
- Comprehensive troubleshooting section
- Visual directory structure diagrams

Resolves deployment configuration issues for hosted environments.
@ka215 ka215 merged commit 0c9a3ac into main Nov 13, 2025
1 check passed
@ka215 ka215 deleted the feature/deployment-guide-v1.3.2 branch November 13, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants