Redirection Loop after changing IP to domain name


#1

I yesterday i have mapped my domain name with to my IP. after that i run this command ee site edit and replaced IP with my domain name here server_name ;

after that i run command cd /var/www/domain.com/htdocs wp search-replace http://1.2.3.4 http://domain.com --dry-run and replaced IP with my domain name. Then i made changes to my wp-config.php file and replace IP with my domain name.

Now i am getting redirection loop.

But when i edit my server_name back to ip. There is no redirect loop then.

What is the issue. I am not able to figure it out.

Here is my site-available Nginx configs

server { # Uncomment the following line for domain mapping # listen 80 default_server; server_name my-domain.com .my-domain.com; return 301 $scheme://my-domain.com$request_uri; # Uncomment the following line for domain mapping #server_name_in_redirect off; access_log /var/log/nginx/104.154.95.37.access.log rt_cache_redis; error_log /var/log/nginx/104.154.95.37.error.log; root /var/www/104.154.95.37/htdocs; index index.php index.html index.htm; include common/redis.conf; include common/wpcommon.conf; include common/locations.conf; include /var/www/104.154.95.37/conf/nginx/.conf;


#2