Question

How Do I view my site via public IP address without pointing the domain?

I’m hosting a wordpress backend using Apache. I’m using Node to actually display the site (nextjs).

Additionally I’m using nginx reverse proxy for both Apache and Node.

so, I followed the guide and set up /etc/ngingx/sites-available/domain.com like this:

server {
        listen 80;
        listen [::]:80;

        root /var/www/domain.com/html;
        index index.html index.htm index.nginx-debian.html;

        server_name domain.com www.domain.com;

        location / {
        proxy_pass http://localhost:8090;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        }

        location /next {
        proxy_pass http://localhost:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
        }

}

When I ssh in and run curl commands, I get the response from both ports.

Unforutnately I cannot yet point the domain to my IP. So in the meanwhile, how can I view the site in browser using public IP?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Greetings!

This is a great question. The standard way of doing this is to use your system host file. This is effectively overriding DNS locally on your system, allowing you to view the domain as though it’s DNS pointed somewhere other than where it actually does. I have a tutorial that I like for this here:

https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/

Jarland

@jarland thank you. I actually figured I should try that some time after posting this question. I am indeed able to view the site after doing this.

The problem that is confusing me though, is that I’m making API calls from inside my app to the domain.com/api-endpoint. So I don’t know what I should be doing with that, if anything. Right now my calls are not being returned.