How to access WordPress Website by IP Address


I’ve seen four (or more) different support requests about this issue and have tried all the options suggested, and yet still cannot access a new WordPress Website, using only the IP Address as the URL.

I can access Admin Tools using http://ip-address:22222 just fine. However, even after updating /etc/hosts with:

IP-Address Domain-Name

…reloading nginx with:

nginx -t && service nginx reload

…and navigating to IP Address, the standard “Welcome to nginx” HTML page is displayed.

I made additional attempts at resolving this issue by changing the following line:

root /var/www/html;




root /var/www/domain-name;


root /var/www/domain-name/htdocs;

…all of which only result in a 403 Error.

Accessing a WordPress Website by IP Address, on EE, can’t be that difficult, can it?



to access your site with the ip address, you need to put your ip address as server_name in your site config.

lets say

ee site edit

Edit following line



@harshadyeola this method causes a re-direct to occur, redirecting to the live website. I’ve included the contents of this file, as I have it configured, currently, below:

# Uncomment the following line for domain mapping
# listen 80 default_server;


# Uncomment the following line for domain mapping
#server_name_in_redirect off;

access_log /var/log/nginx/ rt_cache;
error_log /var/log/nginx/;

root /var/www/;

index index.php index.html index.htm;

include common/wpfc.conf;
include common/wpsubdir.conf;
include common/wpcommon.conf;
include common/locations.conf;
include /var/www/*.conf;

However, I’ve also tried switching:





server_name *;

All of these redirect to the LIVE website found at

To clarify, I’m building a new website for and is already a LIVE site, in a production environment. The new website will be found at and I want to be able to access the installation of WordPress, found there, by navigating to directly. However, as I’ve already indicated above, none of the previously provided solutions, found in other support posts work, and the most recent solution you provided (above) causes to re-direct to the LIVE site found at

What am I missing?


Hello, To me it has worked but the IP addresses at instead of the home page and send me to the homepage. !?


The only way I’ve been able to find to access a WordPress website by IP Address, when installed with EasyEngine, is to install it using the IP Addresses, as shown below:

sudo ee site create the.ip.add.ress --wpsubdir --wpfc

…and then it is only available by IP Address and not a domain. None of the suggestions to access a WordPress website by IP Address have worked.


380 days old and still no resolution…

Why is it that such a common practice of using the IP Address to access a website, until one is ready to go live, is so difficult to do in EE/NGINX?

As indicated above, I have tried the following:





server_name *;


server_name *;

All of the above attempts to access the new EE site, located on are simply redirected to the LIVE website found at


The easiest way, IMHO, is editing your hosts file (your computer, not at the server).

If you use MacOS: sudo vim /private/etc/hosts

Linux: sudo vim /etc/hosts

Windows: Open c:\windows\system32\drivers\etc\hosts

Add one line to this file:

Save the file and access your site. You’ll bypass any DNS resolution and access your site before actually publishing it.


Thank you @janiosarmento

Yes, this is a very effective way to bypass any DNS resolution and I’ve used it a number of times. Most times this works well enough, though it is quite annoying if you need to switch back and forth between DEV and LIVE sites.

I’m specifically interested in an EE supported method, b/c of this annoyance.


As far as I know, there is nothing better then hosts file for this kind of need.


The local hosts file is definitely effective. Just baffled by how this request doesn’t have an easy fix. Have been able to do this with Apache-based WordPress deployments, say with something like Virtualmin, for years.


This php-snippet

remove_action('template_redirect', 'redirect_canonical');

disables “WordPress’-Redirect-behaviour”, with it you can access it by IP-Address.


This does work, mostly…

If I go to https://ip.address/ I’m able to see my WordPress website. GREAT!

@ingobaab Thank you for posting this. Adding this remove_action snippet to the functions.php file, from the command line, is a cinch and a very easy solution.

However, if I go to http://ip.address/ I get the same old “Welcome to nginx” screen:


I think this depends on how your nginx is configured. Does it serve on both HTTP and on HTTPS (ports80/443)? Or does it a redirect from http:// to https://? (301)? I have no experience in “default server - option for HTTPS”, but here is a discussion about it:

–good luck : )


Thanks @ingobaab , I’ll check out the discussion you linked.

I’ll have to look into this a little bit more. I’m currently using the default configuration set by using the:

sudo ee site update --letsencrypt



Check this locations:




and of course:


to see what is configured…


Yes, thank you.

The file is set up like so:

server { listen 80; server_name; return 301$request_uri; }


The /var/www/ file is set up like so:

listen 443 ssl http2; ssl on; ssl_certificate /etc/letsencrypt/live/; ssl_certificate_key /etc/letsencrypt/live/;


The /etc/nginx/sites-enabled/ file is configured like so:

`server {

# Uncomment the following line for domain mapping
# listen 80 default_server;

server_name *;

# Uncomment the following line for domain mapping
#server_name_in_redirect off;

access_log /var/log/nginx/ rt_cache_redis;
error_log /var/log/nginx/;

root /var/www/;

index index.php index.html index.htm;

include common/redis-php7.conf;
include common/wpsubdir.conf;
include common/wpcommon-php7.conf;
include common/locations-php7.conf;
include /var/www/*.conf;



Do you notice anything odd about this configuration?