Can't access my NGINX server through my VPN.

Got a Droplet running as a server. It runs an NGINX server with with a few very simple web pages. Just installed OpenVPN Server on the same machine…its my own Private VPN.

I need to understand how the routing is done?

How can I find how OpenVPN routes traffic from the Internet and back to the Internet through the Droplet ?

Why can’t I access anymore my webpage served by NGINX from the Internet?

Answers are probably in plain sight down here but I don’t understand enough about routing.

root@My_Droplet:~# ip route

default via dev eth0 proto static via dev tun0 dev tun0 proto kernel scope link src dev eth0 proto kernel scope link src dev eth1 proto kernel scope link src dev eth0 proto kernel scope link src

What I wants, is access to what NGINX is serving from the Internet through the VPN.


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.

Site Moderator
Site Moderator badge
April 18, 2024
Accepted Answer

Heya @sergerobitaille,

My first guess would be checking your Firewall and that is blocking your requests. Look for any rules that might be dropping or rejecting traffic on ports used by NGINX (typically 80 and 443).

VPN Configuration: Review your OpenVPN server configuration. Ensure that it is not configured to route all traffic through the VPN, which could change how incoming connections are handled. You might have a push "redirect-gateway def1 bypass-dhcp" setting in your OpenVPN server config file that needs attention.

: Make sure that NGINX is set up to listen on all interfaces or specifically on the public interface (eth0). Check your NGINX config file (nginx.conf and associated site configuration files in /etc/nginx/sites-available/):

server {
    listen 80;
    server_name _; # or your public domain/IP

Connectivity Tests: Perform connectivity tests from both inside and outside your VPN. Check if the NGINX server is accessible from the local network, from the VPN, and from the public internet:

curl http://localhost:80
curl  # Using your private IP

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel