Some URL's Domain's return to IP address

January 5, 2019 505 views
WordPress Nginx PHP Ubuntu

Hello everyone, I have wordpress site and There is no problem with digitalocean domain/ip config. So I’m using Nginx and when I click to some buttons ( not all ) domain name return to ip address.But page looks great. My wordpress General > Settings URL setting like

http://example.com . I mean no problem with that

My nginx conf in /etc/nginx/sites-available/default

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name example.com www.example.com
    add_header 'Access-Control-Allow-Origin' '$http_origin' always;
        add_header X-Frame-Options "SAMEORIGIN";
    # SSL configuration
    #
    # listen 443 ssl default_server;
    # listen [::]:443 ssl default_server;
    #
    # Note: You should disable gzip for SSL traffic.
    # See: https://bugs.debian.org/773332
    #
    # Read up on ssl_ciphers to ensure a secure configuration.
    # See: https://bugs.debian.org/765782
    #
    # Self signed certs generated by the ssl-cert package
    # Don't use them in a production server!
    #
    # include snippets/snakeoil.conf;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm index.nginx-debian.html;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ /index.php?q=$uri&$args;
        #try_files $uri $uri/ =404;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
    #
    #   # With php-fpm (or other unix sockets):
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    #   # With php-cgi (or other tcp sockets):
    #   fastcgi_pass 127.0.0.1:9000;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny all;
    }
}


# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

Here is digitalocean conf
https://ibb.co/jgX8Fbp

2 Answers

Have you cleared the WP cache (if any)? Also, did you hard code the IP in the theme or perhaps in some pages?

Cheers

  • Yeah I cleared cache from WP Super Cache already. Actually, I don’t think so but I checked. It looks no problem with theme or pages. How can I know where is the problem? The conf is clear?

  • If I click the category page, it’s come like that : ip/women but If I take “get shortlink” page settings from wp-admin and open the link. It looks example.com/women . Such a weird.

Can you search in wp-content/themes for the IP like this:

grep "IP_ADD_RESS" -r wp-content/theme

Maybe the IP is hard coded there.

Have another answer? Share your knowledge.