简体   繁体   English

如何将域名连接到wordpress网站?

[英]How can I connect my domain name to my wordpress site?

Before I start, I searched a lot to solve my problem (and by a lot, I mean ... a lot). 在开始之前,我进行了很多研究以解决问题(并且很多意思是……很多)。 BTW sorry for my English 顺便说一句对不起我的英语

Here is my problem: I have a Wordpress site, currently located at the following IP http://192.222.217.18 这是我的问题:我有一个Wordpress网站,当前位于以下IP http://192.222.217.18

On this server, I use nginx, php7.0-fpm and mysql, everything was working fine 在此服务器上,我使用nginx,php7.0-fpm和mysql,一切正常

Now, I bought a domain name (at godaddy.com), this one: http://www.deals-with-it.com/ 现在,我在godaddy.com上购买了一个域名,这个域名是: http : //www.deals-with-it.com/

I "linked" it to my wordpress ip address (192.222.217.18) through the godaddy interface. 我通过godaddy界面将其“链接”到我的wordpress IP地址(192.222.217.18)。

After that I simply modified the home and siteurl parameter of wordpress to my new domain name. 之后,我只是将wordpress的home和siteurl参数修改为我的新域名。

And ..... it didn't work. 而且.....没有用。

Now when I try to access my wordpress blog from www.deals-with-it.com, it redirects me to my IP address 192.222.217.18 (I can see my address in the address bar of the navigator, I don't want that), the CSS don't work, and all links are broken ... 现在,当我尝试从www.deals-with-it.com访问我的wordpress博客时,它会将我重定向到我的IP地址192.222.217.18(我可以在导航器的地址栏中看到我的地址,我不希望那样),CSS不起作用,并且所有链接都断开了...

I think the problem come from nginx, but I already tried everything on this side ... 我认为问题出在nginx,但我已经尝试了这一方面的一切...

I also purged wordpress and reinstalled it, same for the database. 我还清除了wordpress并重新安装了它,与数据库相同。

Here is the EXACT state of my my current platform: 这是我当前平台的精确状态:

First of all, the godaddy DNS configuration 首先,godaddy DNS配置

enter image description here 在此处输入图片说明

The IP is not the one I entered (192.222.217.18), but it seems to work anyway 该IP不是我输入的IP(192.222.217.18),但它似乎仍然可以正常工作

My nginx configuration /etc/nginx/sites-available/wordpress 我的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;
    }
}

(The socket /run/php/php7.0-fpm.sock exists) My wordpress /var/www/wordpress/wp-config.php file (only an extract that I modified) (套接字/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];
}

I also added cgi.fix_pathinfo = 0; 我还添加了cgi.fix_pathinfo = 0; to my /etc/php/7.0/fpm/php.ini file 到我的/etc/php/7.0/fpm/php.ini文件

I have nothing in my nginx logs, they are currently removed but I used to have logs defined in the file /etc/nginx/sites-available/wordpress , and nothing was wrong (no errors logged by nginx) 我的nginx日志中没有任何内容,目前已将其删除,但是我曾经在/ etc / nginx / sites-available / wordpress文件中定义了日志,并且没有任何错误(nginx记录的错误)

I also modified the wordpress database to replace all 192.222.217.18 occurences to deals-with-it.com 我还修改了wordpress数据库,以将所有192.222.217.18个事件替换为deal-with-it.com

I honestly searched everywhere since yesterday, tried a lot of things, and I'm still stuck here, so if you could help me ... 从昨天开始,我诚实地到处搜索,尝试了很多事情,但我仍然停留在这里,所以如果您可以帮助我...

Thank you for your help 谢谢您的帮助

Edit: I managed to have the righ address showing in the address bar of my navigator, by changing the IP into godaddy with the right IP, and I also changed the WP_HOME URL to define('WP_HOME',' http://deals-with-it.com/wordpress '); 编辑:通过将IP更改为具有正确IP的Godaddy,我设法在导航器的地址栏中显示了正确的地址,并且还更改了WP_HOME URL以定义('WP_HOME',' http:// deals- with-it.com/wordpress '); But now I have 403 error for all my links 但是现在我所有链接都有403错误

To add your own domain name you just have to configure WordPress to point to your domain. 要添加自己的域名,您只需配置WordPress即可指向您的域。 This can be done by adding go daady name-servers (can be found in your go daady account) into WordPress. 这可以通过将go daady名称服务器(可以在go daady帐户中找到)添加到WordPress中来完成。 Search for something like adding name-servers in WordPress. 搜索类似在WordPress中添加名称服务器的内容。 This will do the trick. 这将达到目的。

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

相关问题 如何在 wordpress 站点中添加自己的 class 名称? - How can I add my own class name in wordpress site? 打开 WordPress 站点时,我的域名发生了变化 - My domain name changes when I open up a WordPress site 如何在我的Wordpress网站上使用自定义子域名? - How to use custom sub-domain name with my Wordpress site? WordPress:在计算机上开发站点时如何使用域名? - WordPress: how do I use a domain name when developing a site on my computer? 我可以将网站复制到另一个域并在其上放置wordpress主题吗? - Can I copy my site to another domain and put wordpress theme on it? 如何让我的 WordPress 网站在成功登录后重定向到子域,它们将重定向回根域 - How can I make my WordPress site redirect to subdomain once successfully login they will redirect back to root domain 在我的 Wordpress 网站上显示 IP 地址而不是域名 - IP Address showing instead of Domain name on my Wordpress site 在我的wordpress网站上使用Google Compute Engine。 如何为我的域启用DNS? - Using Google Compute Engine for my wordpress site. How do I enable DNS for my domain? 如何更改我的WordPress域名? - How to change my wordpress domain name? 如何使移动用户连接到我的子域? - How can I make mobile users connect to my sub domain?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM