简体   繁体   中英

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

On this server, I use nginx, php7.0-fpm and mysql, everything was working fine

Now, I bought a domain name (at godaddy.com), this one: http://www.deals-with-it.com/

I "linked" it to my wordpress ip address (192.222.217.18) through the godaddy interface.

After that I simply modified the home and siteurl parameter of wordpress to my new domain name.

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 ...

I think the problem come from nginx, but I already tried everything on this side ...

I also purged wordpress and reinstalled it, same for the database.

Here is the EXACT state of my my current platform:

First of all, the godaddy DNS configuration

enter image description here

The IP is not the one I entered (192.222.217.18), but it seems to work anyway

My nginx configuration /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)

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; to my /etc/php/7.0/fpm/php.ini file

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)

I also modified the wordpress database to replace all 192.222.217.18 occurences to deals-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 '); But now I have 403 error for all my links

To add your own domain name you just have to configure WordPress to point to your domain. This can be done by adding go daady name-servers (can be found in your go daady account) into WordPress. Search for something like adding name-servers in WordPress. This will do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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