Skip to content
/ ServerlessWP Public template
forked from mitchmac/ServerlessWP

Host WordPress sites on Vercel, Netlify, or AWS Lambda

License

Notifications You must be signed in to change notification settings

ryantoth2410/ServerlessWP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ServerlessWP

WordPress hosting for cheap perfectionists

Many WordPress websites could be replaced by static HTML. Static websites are cheaper, faster, and more secure to host. Why not use WordPress as a static website generator so we can still edit content via our web browser and use many of the great WordPress themes and plugins?

Learn more

ServerlessWP enables hosting the backend WordPress installation, where we add and manage content, on AWS Serverless products so that we don't have to worry about maintaining a server. Serverless means we only pay for what we use, and most websites don't get edited too often. Combined with AWS free tier offerings, we can host the backend for next to nothing in cost.

ServerlessWP puts Basic Authentication in front of the backend WordPress installation to limit its exposure to bots and other sources of unwanted traffic.

The backend WordPress website is crawled to generate the static website. The static HTML is uploaded to Amazon S3 for storage and hosting. AWS CloudFront is used to provide CDN hosting and SSL for the public-facing website.

Disclaimer: This is a proof of concept!

Installation

  1. Install the Serverless Framework for AWS - Serverless installation guide
  2. Clone or download this repository
  3. Place necessary binary files in the "bin" directory.
    • "php-cgi" and "wget" are the currently necessary binaries. They must be compiled to run in the Lambda environment.
    • This can be handled by running the "./build_bin.sh" script if you have Docker installed.
    • The "./bin/lib" directory requires a library noted in bin/lib/readme.txt. It will be put in place if "./build_bin.sh" is used.
  4. Place a WordPress installation directly in the "wp" directory so that "index.php" is found in the root of "wp".
    • This can be handled by executing the "./build_wp.sh" script.
  5. Modify "wp-config.php" for ServerlessWP friendly configuration.
    • This is handled by the "./build_wp.sh" script if used.
    • Otherwise, use this wp-config-base.php as a guide.
  6. To handle file uploads in the WordPress backend, install the necessary WordPress plugins (also handled by the "./build_wp.sh" script):
  7. Place any other WordPress themes or plugins in the respective wp-content directories like a standard WordPress installation.
  8. Edit serverless.yml
    • The "custom" section at the top of the file has variables that should be reviewed.
  9. Run "npm init"
  10. Run "severless deploy"
  • The initial time this is run, it may take 30-60 minutes for AWS to create the necessary resources.

Authors

Acknowledgments

The following articles and repositories provided ideas, examples, and best practices for various parts of the project:

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Host WordPress sites on Vercel, Netlify, or AWS Lambda

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 67.1%
  • JavaScript 23.8%
  • CSS 8.3%
  • Svelte 0.4%
  • SCSS 0.4%
  • HTML 0.0%