I have an Nginx server running on my local network, and I want to make it accessible from the internet via an OpenVPN connection. Here are the details of my setup:
Ubuntu Server Local IP Address:
192.168.29.110
OpenVPN Access Server IP Address:
139.59.60.64
Notes:
- OpenVPN Access Server is running on a DigitalOcean Ubuntu Server (called OpenVPN-server hereon)
- Nginx is running on a local Ubuntu Server at home (called Nginx-server hereon)
- Home network (ISP) doesn't allow dedicated IP / port forwarding due to which I'm unable to access my Nginx-server from outside the LAN network. Therefore the goal is to connect local Nginx-server to OpenVPN-server so as to use the IP address of the VPN connected and thereby allow Nginx-server to be accessible from the word wide web (public internet).
- UFW is disabled on both OpenVPN-server as well as Nginx-server.
- DigitalOcean firewall is disabled.
Network Configuration on Nginx-server: Netplan configuration (/etc/netplan/01-netcfg.yaml):
network:
ethernets:
eno1:
addresses:
- 192.168.29.110/24
nameservers:
addresses:
- 8.8.8.8
search: []
routes:
- to: default
via: 192.168.29.1
version: 2
Nginx Configuration on Nginx-server: Nginx configuration file (/etc/nginx/sites-available/default):
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name 139.59.60.64;
location / {
proxy_pass http://192.168.29.110; # Update this line
include proxy_params;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Challenges and Questions:
- Replacing OpenVPN Dashboard with Nginx Landing Page:
- I currently access the OpenVPN Access Server dashboard from the IP
address
139.59.60.64
. After establishing a connection from Nginx-server to the OpenVPN-server, I want to replace the dashboard with my local Nginx landing page. How can I achieve this?
- Making Nginx Accessible from the Internet via OpenVPN:
- After connecting to the OpenVPN-server, what changes do I need to make in my Nginx configuration file and Netplan configuration on Nginx-server to access my Nginx-server from the internet?