首页 > 解决方案 > 如何将我的域名连接到我的 wordpress 网站?

问题描述

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

这是我的问题:我有一个 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配置

在此处输入图像描述

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;
    }
}

(套接字 /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 更改为 define('WP_HOME',' http:// deals- with-it.com/wordpress '); 但是现在我的所有链接都有 403 错误

标签: wordpressnginxdnsphp-7

解决方案


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


推荐阅读