Hosting Wordpress on Serverless Architecture

118 Views Asked by At

I am building serverless architecture for wordpress and facing issue in re-direction to wp-admin page

Hi, I am preparing serverless architecture for wordpress hosting on AWS Lambda. I have referred few architecture based on serverless on ([https://keita.blog/2019/06/27/serverless-wordpress-on-aws-lambda/]) and here they used cloudfront, apigateway and lambda functions. I have prepared the PHP7.4 runtime for wordpress with required dependencies by referring ([https://github.com/stackery/php-lambda-layer.git]). Dependencies are installed by using build.sh script file ([https://github.com/stackery/php-lambda-layer/blob/master/build.sh]) Refer SAM Template here [https://github.com/keichan34/wordpress-on-lambda/blob/master/template.yaml] In source code, handler.php is [https://github.com/keichan34/wordpress-on-lambda/blob/master/src/php/handler.php]

So while deploying this architecture I am facing issue in routing. While making request from lambda Url it shows body with empty response and returns 302 status code like below "multiValueHeaders":{"Host":["localhost:8000"],"Date":["Wed, 27 Sep 2023 11:55:48 GMT"],"Connection":["close"],"X-Powered-By":["PHP\/7.4.33"],"X-ExecFile":["\/var\/task\/index.php"],"Expires":["Wed, 11 Jan 1984 05:00:00 GMT"],"Cache-Control":["no-cache, must-revalidate, max-age=0"],"X-Redirect-By":["WordPress"],"Location":["https:\/\/localhost:8000\/wp-admin\/install.php"],"Content-type":["text\/html; charset=UTF-8"]},"body":"","statusCode":302} and also when making request via cloudfront domain it is redirecting to apiurl with wp-admin/install.php path but return as forbidden message like below Forbidden Error

And if we make cloudfront url (eg: /wp-admin/install.php it shows the wordpress install page it show like below image Wordpress Install Page

and able configure site settings and even it showed the basic blog page with cloudfront dns. But not able to login to admin page as it shows same Forbidden error. So some pages like database error connection page, basic sample blog page are able to access but main issue is not able to login to wp-admin page as it shows only forbidden error. So Please help me to resolve the issue,and help to solve why it is not able to move to admin page. Note: Not able to redirect to wp-admin page as it shows Forbidden.

0

There are 0 best solutions below