I have a local web site called http://localhost.example.com but now when I try to open it in a web browser it redirects me to http://www.example.com. This used to work before. What I changed in the system was the configuration of AWS CLI and the Bitbucket local configuration in order to use two different accounts. Nothing more. I believe that changes are irrelevant. Aren't they?
All the information and files I provide are from local workstation. I'm using OS X 10.12 (beta 2).
The relevant part of /etc/hosts is this:
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 127.0.0.1 localhost.example.com 127.0.0.1 babydiapi.example.com 127.0.0.1 localhost.mi.example.com 127.0.0.1 localhost.qr.example.com 127.0.0.1 localhost.pay.example.com 127.0.0.1 playground.com 127.0.0.1 payments.com 127.0.0.1 localhost.comunidad.example.com 198.58.110.224 web1.example.com 198.58.115.115 web2.example.com 45.56.67.40 web3.example.com
But I make ping localhost.example.com
I get this:
PING localhost.example.com (104.200.16.137): 56 data bytes 64 bytes from 104.200.16.137: icmp_seq=0 ttl=49 time=166.894 ms
I tried to do ping http://localhost.example.com
but it didn't worked:
ping: cannot resolve http://localhost.example.com: Unknown host
I suppose this is a normal behavior.
Which is the staging server for my application. Clearly not localhost.
I read somewhere that I should use host localhost.example.com
, but I still get this:
localhost.example.com has address 104.200.16.137
I use Nginx as my local web server, the configuration looks like this:
server { listen 127.0.0.1:80; listen 127.0.0.1:443 ssl; server_name localhost.example.com; server_name_in_redirect off; error_page 404 /www/error/404.html; error_page 503 /www/error/404.html; ssl_certificate /usr/local/etc/nginx/ssl/localhost.crt; ssl_certificate_key /usr/local/etc/nginx/ssl/localhost.key; access_log /usr/local/etc/nginx/logs/www.example.com.access.log; error_log /usr/local/etc/nginx/logs/www.example.com.error.log; location ~ ^/(.*)/$ { rewrite ^/(.*)/$ /$1 permanent; } location ~* ^.+(\.jpg|\.jpeg|\.gif|\.png|\.js|\.ico|\.woff|\.ttf|\.eot|\.css)$ { root /www/www.example.com/webroot; access_log off; expires 365d; } location / { root /var/www/www.example.com/webroot/; index index.php index.html index.htm; if (-f $request_filename) { break; } if (-d $request_filename) { break; } if (-f $request_filename) { break; } # Trigger 503 response on maintenance set $mantenimiento 0; if (-f /var/www/www.example.com/.mantenimiento) { set $mantenimiento 1; } if ($remote_addr = 127.0.0.1) { set $mantenimiento 0; } if ($mantenimiento) { return 503; } if (!-f $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; break; } } location ~ .*\.php[345]?$ { set $script $uri; set $path_info ""; if ($uri ~ "^(.+\.php)(/.+)") { set $script $1; set $path_info $2; } include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/www.example.com$fastcgi_script_name; fastcgi_param SCRIPT_NAME $script; fastcgi_param PATH_INFO $path_info; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_read_timeout 300; } location @error_web { root /var/www/error; index 404.html; } }
Do you have any ideas or hints? I have been looked over the internet for about a week and found nothing helpful.