简体   繁体   English

AWS Elastic BeanStalk + Wordpress URL 重写问题

[英]AWS Elastic BeanStalk + Wordpress URL rewrite Issue

Hey Guys i deployed wordpress with Elastic Bean Stalk ( i have nginx + RDS ) but only wordpress home page working fine but URL rewrite not working.大家好,我用 Elastic Bean Stalk 部署了 wordpress(我有 nginx + RDS),但只有 wordpress 主页工作正常,但 URL 重写不工作。 ( wordpress home page working fine & wordpress from NON google friedly URL works fine ) problem is with URL rewrite anyone has any idea how we can solve this OR how we can install APACHE on AWS EBS ( i am using EBS + RDS + Code Pipeline ) (wordpress 主页工作正常 & wordpress 来自 NON google friedly URL 工作正常)问题是 URL 重写任何人都知道我们如何解决这个问题或者我们如何在 AWS EBS 上安装 APACHE(我正在使用 EBS + RDS + Code Pipeline)

There isn't much detail to go on here but it sounds like you may need to update your NGINX configuration in order to point non-static files to index.php so that WordPress 'process' them accordingly.这里没有关于 go 的详细信息,但听起来您可能需要更新 NGINX 配置,以便将非静态文件指向 index.php,以便 WordPress 相应地“处理”它们。

If you add this to your nginx.conf file (in /etc/nginx/ ) inside the server{} block:如果将此添加到server{}块内的nginx.conf文件(在/etc/nginx/中):

    location / {
      try_files $uri $uri/ /index.php?$query_string;
    }

Then reboot NGINX and test WordPress URLs to see if it worked:然后重新启动 NGINX 并测试 WordPress 的 URL 以查看它是否有效:

sudo service nginx restart

If that does the job then you will need to make this change permanent, otherwise as your Elasticbeanstalk environment scales or is re-deployed the change will revert.如果那样做,那么您将需要使此更改永久化,否则随着您的 Elasticbeanstalk 环境扩展或重新部署,更改将恢复。 To do this depends if you are using Amazon Linux 2 or the Amazon Linux AMI.要执行此操作取决于您使用的是 Amazon Linux 2 还是 Amazon Linux AMI。

If you are using AL2 then you need to add this change to the .platform/nginx/conf.d/elasticbeanstalk/ directory of your local development environment and re-deploy, see here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html如果您使用的是 AL2,则需要将此更改添加到本地开发环境的.platform/nginx/conf.d/elasticbeanstalk/目录并重新部署,请参见此处: https://docs.aws.amazon.com /elasticbeanstalk/latest/dg/platforms-linux-extend.html

If using the Amazon Linux AMI you will need to create a .conf file in the .ebextensions folder which implements the change upon deployment, see here: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-configuration-files/如果使用 Amazon Linux AMI,您需要在.ebextensions文件夹中创建一个.conf文件,以在部署时实施更改,请参见此处: https://aws.amazon.com/premiumsupport/knowledge-center/elastic-beanstalk-配置文件/

The AWS provides official whitepapers and guides on how to properly setup and run Wordpress on Beanstalk. AWS 提供有关如何在 Beanstalk 上正确设置和运行 Wordpress 的官方白皮书和指南。 I put the links to them, since from your question it is not clear if you followed any of them and why they don't work, nor why they are not suited for your use case:我把它们的链接放在一起,因为从你的问题来看,不清楚你是否遵循了它们中的任何一个,为什么它们不起作用,也不清楚为什么它们不适合你的用例:

If your needs are different, updating the question with more details and explanations would be useful to provide more detailed answer.如果您的需求不同,用更多细节和解释更新问题将有助于提供更详细的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM