Our team has developed a custom platform for AWS Elastic Beanstalk, designed to improve performance, scalability, and flexibility for modern web applications. This whitepaper details the technical aspects of our custom platform, which incorporates nginx, PHP 7.1, PHP-FPM, Google PageSpeed plugin, and PHP-FPM caching on Amazon Linux.
The Challenge: AWS Elastic Beanstalk with nginx and PHP
Configuring nginx, PHP 7.1, PHP-FPM, Google PageSpeed plugin, and PHP-FPM caching on AWS Elastic Beanstalk can be complex and time-consuming. The default AWS Elastic Beanstalk PHP platform only supports Apache, necessitating a custom solution.
The Solution: Custom AWS Elastic Beanstalk Platform
We have created a custom AWS Elastic Beanstalk platform tailored to efficiently run nginx and PHP, allowing for greater customization and control over the software stack and system configurations. The custom platform’s scripts are available on our Github account.
Key Components of the Custom Platform
Our custom AWS Elastic Beanstalk platform includes:
- nginx 1.12.1
- PHP 7.1 with various modules
- PHP-FPM 7.1
- Google PageSpeed nginx plugin
- PHP-FPM caching
- nginx GZIP compression
Optimizations and Considerations
When using our custom AWS Elastic Beanstalk platform, consider the following:
- Both PHP-FPM and Google PageSpeed plugin caches are cleared upon app deployment or server restart.
- Adjust PHP-FPM parameters based on your EC2 instance type (pm, pm.max_children, pm.start_servers, pm.min_spare_servers, pm.max_spare_servers).
- The PHP memory limit is set to 512M.
- Log rotation is enabled for both nginx and PHP-FPM logs.
- Health checks for nginx and PHP-FPM are functional.
- Cron service restarts upon app deployment.
Ongoing Development and Support
We will continue to update and enhance our custom AWS Elastic Beanstalk platform, releasing modifications via Github. For any questions or assistance, please feel free to contact us. Our team is dedicated to helping you optimize your web applications’ performance and scalability.