【问题标题】:How can I connect my domain name to my wordpress site?如何将我的域名连接到我的 wordpress 网站?
【发布时间】:2019-02-23 02:51:57
【问题描述】:

在我开始之前,我搜索了很多东西来解决我的问题(而且很多,我的意思是......很多)。顺便说一句,对不起我的英语

这是我的问题:我有一个 Wordpress 网站,目前位于以下 IP http://192.222.217.18

在这台服务器上,我使用了 nginx、php7.0-fpm 和 mysql,一切正常

现在,我买了一个域名(在 godaddy.com),这个:http://www.deals-with-it.com/

我通过godaddy接口将它“链接”到我的wordpress IP地址(192.222.217.18)。

之后我只是简单地将wordpress的home和siteurl参数修改为我的新域名。

而且.....它没有用。

现在,当我尝试从 www.deals-with-it.com 访问我的 wordpress 博客时,它会将我重定向到我的 IP 地址 192.222.217.18(我可以在导航器的地址栏中看到我的地址,但我没有不想要),CSS 不起作用,所有链接都坏了......

我认为问题来自于nginx,但我已经尝试了这方面的一切......

我还清除了 wordpress 并重新安装了它,数据库也是如此。

这是我当前平台的确切状态:

首先是godaddy DNS配置

enter image description here

IP不是我输入的(192.222.217.18),但好像还是可以的

我的nginx配置/etc/nginx/sites-available/wordpress

# Upstream to abstract backend connection(s) for php
upstream php {
    server unix:/run/php/php7.0-fpm.sock;
    server 127.0.0.1:9000;
}

server {
    ## Your website name goes here.
    server_name www.deals-with-it.com deals-with-it.com;
    ## Your only path reference.
    root /var/www/wordpress;
    ## This should be in your http block and if it is, it's not needed here.
    index index.php;

    location = /favicon.ico {
            log_not_found off;
            access_log off;
    }

    location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
    }

    location / {
            # This is cool because no php is touched for static content.
            # include the "?$args" part so non-default permalinks doesn't break when using query string
            try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
            #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
            include fastcgi.conf;
            fastcgi_intercept_errors on;
            fastcgi_pass php;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
            expires max;
            log_not_found off;
    }
}

(socket /run/php/php7.0-fpm.sock 存在) 我的 wordpress /var/www/wordpress/wp-config.php 文件(只是我修改的摘录)

define('WP_HOME','http://deals-with-it.com');
define('WP_SITEURL','http://deals-with-it.com');
// Code for showing correct client IP address
if ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
    $mte_xffaddrs = explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] );
    $_SERVER['REMOTE_ADDR'] = $mte_xffaddrs[0];
}

我还添加了 cgi.fix_pathinfo = 0;到我的 /etc/php/7.0/fpm/php.ini 文件

我的 nginx 日志中没有任何内容,它们目前已被删除,但我曾经在文件 /etc/nginx/sites-available/wordpress 中定义了日志,并且没有任何问题(没有错误由 nginx 记录)

我还修改了 wordpress 数据库,将所有出现的 192.222.217.18 替换为 deals-with-it.com

老实说,从昨天开始我到处搜索,尝试了很多东西,但我仍然卡在这里,所以如果你能帮助我......

感谢您的帮助

编辑:我设法在我的导航器的地址栏中显示了正确的地址,通过将 IP 更改为具有正确 IP 的 Godaddy,我还将 WP_HOME URL 更改为定义('WP_HOME','http://deals-with-it.com/wordpress '); 但是现在我的所有链接都有 403 错误

【问题讨论】:

    标签: wordpress nginx dns php-7


    【解决方案1】:

    要添加您自己的域名,您只需将 WordPress 配置为指向您的域。这可以通过将 go daady 名称服务器(可以在您的 go daady 帐户中找到)添加到 WordPress 来完成。搜索类似在 WordPress 中添加名称服务器的内容。这会成功的。

    【讨论】:

      猜你喜欢
      • 2016-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-22
      • 1970-01-01
      • 2010-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多