OK, I'm tearing my hair out with this one. And will hopefully face palm when someone lets me know the obvious (but not to me) answer.
I've got a working site at https://example.com running apache, SSL and php5.5. I want to change to nginx and update to php7.0. I was afraid of killing my site by trying to switch/upgrade on the production server - especially the php5.5 to php7.0 upgrade, which I understand can be hairy.
So I set up a brand new server, Ubuntu 16.04, nginx, php 7.0, installed Wordpress, set up my nginx/sites-available, created mysite.conf, symlinked it to sites-enabled, set up my php-fpm conf files, all that good stuff. Want to get everything perfect before I update the A records, etc. to point the domain name at the new server.
When I configure mysite.conf to
server_name my_IP_address
everything's fine. (Except of course all the images are brought in from the old site, and all the post links point there too, which makes sense.)
So the obvious next step is to point my local hosts files at the new site, using the correct domain name, so I can test the heck out of everything, get all those pesky plugins and caching working, etc.
However, when I set my OS X /etc/hosts file to:
my_IP_address example.com
and change mysite.conf file to
server_name example.com
I still go to the "old" site.
If I do
ping example.com
from my Mac, it successfully shows I am pinging the new server.
BUT if I change my /etc/hosts file to something silly like:
my_IP_address fooexample.com
and change mysite.conf to
server_name fooexample.com
That works too!
What the heck is going on? Is this an SSL issue? Do I need to move my certs over from the old site to the new one and get https working first? Or am I overlooking something obvious and dumb? (Probably)
Thanks in advance for any help!