Here's a ready-to-use Docker Compose configuration file for setting up OpenVPN Access Server. Make sure Docker Engine and Docker Compose Plugin (v2.0 or higher) are installed as per the official document.
services:
openvpn-as:
image: openvpn/openvpn-as
container_name: OpenVPN
cap_add:
- NET_ADMIN
ports:
- "943:943"
#- "443:443" # uncomment this line if you want to use TCP
- "1193:1193/udp"
volumes:
- openvpn-data:/openvpn
restart: unless-stopped
volumes:
openvpn-data:
Edit and Save: Open your docker-compose.yml
file, paste in the configuration, save, and exit.
- Start OpenVPN Access Server: Once the server is running, go to
https://your-local-ip:943/admin/
to complete setup, including creating users and downloading connection files. If this URL doesn’t work, try using http
instead of https
.- Default admin login and password is openvpn/openvpn
- For regular user login, use
https://your-local-ip:943
without the /admin
part - It's recommended to use a reverse proxy, like Caddy or Nginx, to securely expose your OpenVPN Access Server to the internet
- To allow VPN users access to your local network, follow these steps:
- Go to Configuration -> VPN Settings -> Routing.
- Select Yes, using NAT.
- In the input box on the right, enter your local subnet in CIDR notation, such as:
192.168.0.0/24
Below is a breakdown of the docker-compose.yml
file explained by ChatGPT:
cap_add: NET_ADMIN
: Grants the container network administration capabilities, necessary for managing VPN connections and network settings, which are central to OpenVPN’s functionality.ports
:943:943
: Maps the web admin and user interface for OpenVPN Access Server to port 943 on the host machine. This allows access to the admin UI at https://your-local-ip:943/admin
.1193:1193/udp
: Maps the default UDP port (1193) used by OpenVPN for client connections. UDP is the recommended protocol for VPNs due to its speed and reliability. - Optional
443:443
(commented): This line, if uncommented, allows connections over TCP on port 443, which can be useful if UDP connections are restricted on a network.
volumes
:openvpn-data:/openvpn
: Stores OpenVPN configuration and user data in a persistent Docker volume (openvpn-data
). This ensures that all data remains intact even if the container restarts, preserving configurations, certificates, and user accounts.
Here's a ready-to-use Docker Compose configuration file for setting up OpenVPN Access Server. Make sure Docker Engine and Docker Compose Plugin (v2.0 or higher) are installed as per the official document.
Edit and Save: Open your
docker-compose.yml
file, paste in the configuration, save, and exit.https://your-local-ip:943/admin/
to complete setup, including creating users and downloading connection files. If this URL doesn’t work, try usinghttp
instead ofhttps
.https://your-local-ip:943
without the/admin
part192.168.0.0/24
Below is a breakdown of the
docker-compose.yml
file explained by ChatGPT:cap_add: NET_ADMIN
: Grants the container network administration capabilities, necessary for managing VPN connections and network settings, which are central to OpenVPN’s functionality.ports
:943:943
: Maps the web admin and user interface for OpenVPN Access Server to port 943 on the host machine. This allows access to the admin UI athttps://your-local-ip:943/admin
.1193:1193/udp
: Maps the default UDP port (1193) used by OpenVPN for client connections. UDP is the recommended protocol for VPNs due to its speed and reliability.443:443
(commented): This line, if uncommented, allows connections over TCP on port 443, which can be useful if UDP connections are restricted on a network.volumes
:openvpn-data:/openvpn
: Stores OpenVPN configuration and user data in a persistent Docker volume (openvpn-data
). This ensures that all data remains intact even if the container restarts, preserving configurations, certificates, and user accounts.Read Next
家庭服务器:OpenVPN Access Server
SCADA: Water Cooling
An advanced water cooling control system optimizes temperature regulation and energy efficiency through real-time monitoring, intelligent automation, and redundancy for enhanced reliability.
SCADA: Solar Tracking
A solar energy monitoring system optimizes power usage, balancing solar and grid energy in real-time to prevent overages and maximize efficiency.
SCADA: C.S. Tank
A Chemical Strengthening Oven combines unmatched capacity, precision, and intelligent automation to produce the largest chemically strengthened glass pieces in the U.S. with minimal downtime.