You can define these in your wp-config.php
file:
define('WP_HOME', 'http://'.$_SERVER["SERVER_NAME"]); // blog url
define('WP_SITEURL', 'http://'.$_SERVER["SERVER_NAME"]); // site url
Now, you’ll need to make sure nginx is populating SERVER_NAME appropriately (I’ve had setups that were wrong and kept returning “_”).
This will prevent wordpress form redirecting because it thinks it’s already on the correct domain, and will also affect most generated local permalinks as well.
If that doesn’t work (I only used it on one setup and it’s only relevant to accessing the backend), you can add hooks to the 'option_siteurl'
and 'option_home'
filters to achieve the same affect.