简体   繁体   English

在aws ec2中设置wordpress服务器弹性ip后,我的wordpress无法请求静态文件

[英]After I set my wordpress server elastic ip in aws ec2,my wordpress can't request static file

I build a wordpress in aws EC2,everything goes well until I bind a Elastic IP to my wordpress server. 我在aws EC2中构建了一个wordpress,一切顺利,直到我将弹性IP绑定到我的wordpress服务器。 The question is wordpress static file request is still the default aswec2 public dns, but I can see the page without css/js. 问题是wordpress静态文件请求仍然是默认的aswec2公共DNS,但我可以看到没有css / js的页面。

Web server:apache2;Database: aws RDS(mysql);php version:5.3.10;My wordpress address: www.aoaostudio.com ; Web服务器:apache2;数据库:aws RDS(mysql); php版本:5.3.10;我的wordpress地址: www.aoaostudio.com ;

Because before I bind a Elastic IP, I visit the aws public dns:ec2-***-.ap-northeast-1.compute.amazonaws.com ,my wordpress blog is ok! 因为在我绑定弹性IP之前,我访问了aws public dns:ec2-***-.ap-northeast-1.compute.amazonaws.com ,我的wordpress博客还可以!

I feel my apache2 configuration maybe wrong, the configuration file is as follows: 我觉得我的apache2配置可能有误,配置文件如下:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName www.aoaostudio.com
        DocumentRoot /var/www/wordpress
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/wordpress>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

I have no idea about php, maybe my question is fool, but I hope someone can give a help. 我不知道php,也许我的问题很愚蠢,但我希望有人可以提供帮助。

You probably installed wordpress while you didn't have the elastic IP, so Wordpress remembered your URL as ec2-... 您可能在没有弹性IP时安装了wordpress,因此Wordpress记住您的URL为ec2 -...

There is a tutorial for changing the URL of your Wordpress installation here . 有改变你的WordPress安装的URL的教程在这里 Follow it, using www.aoaostudio.com as your URL. 按照它,使用www.aoaostudio.com作为您的URL。

Basically, what you need to do is to add these lines at the top of the functions.php file, right after the opening <?php tag: 基本上,你需要做的是在开始<?php标签之后立即在functions.php文件的顶部添加这些行:

update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );

Then just load the admin login page a few times, and the URLs should update. 然后只需加载管理员登录页面几次,URL就会更新。 It's very important that after all URLs are updated, you remove the code. 更新所有URL后,删除代码非常重要

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

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