【发布时间】:2018-10-20 06:37:59
【问题描述】:
我们正在将文件从 godaddy 托管移动到 AWS。
我创建了一个 Ubuntu 16.04 EC2 实例和 MySQL RDS 并成功移动了文件。
我对数据库配置进行了更改,并根据 nginx 配置了我的主机文件。
我的问题是
1) 当我输入公共 IP 地址(弹性 IP)时,它会路由到 Godaddy 中托管的站点。但是,如果我对 wp-config.php 数据库设置进行更改,它们会得到反映并且指向 AWS。有没有其他人遇到同样的问题。
所以当我遇到任何问题时,它指向 AWS 的 IP,但是如果一切正常,它指向 GoDaddy 的 IP。
我必须在这里提到的一件事是域和站点仍然托管在 godaddy 中。
nginx conf 文件如下所示
server {
listen 80;
server_name _;
root /var/www/example.com/public_html/;
index index.php index.html;
access_log /var/log/nginx/domain-access.log;
error_log /var/log/nginx/domain-error.log;
location / {
try_files $uri $uri/ /index.php?$args;
index index.php index.html;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
我没有在 hosts 文件中硬编码任何 IP,因为它只有默认值。
这里是 /etc/hosts 文件
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
【问题讨论】:
-
那里有一些令人困惑的矛盾陈述,但是,您在某些站点配置文件中有硬编码 IP 的修复
-
很抱歉,但问题本身令人困惑。我已经在这里输入了我的站点配置文件和主机文件。还有其他地方我需要检查吗,因为我没有在任何地方硬编码
标签: php wordpress amazon-web-services nginx amazon-ec2