-3

What is the best way to set OpenVPN Connect on the same server where Apache HTTP Deeamon is running.

I have multiple domains hosted on that server and I want to configure OpenVPN on vpn.example.com for client connect.

I tried to setup proxy on Apache so that https://vpn.example.com will point to localhost:943 but it won't work :(

1
  • Do you really understand how OpenVPN works, and that it has nothing to do with HTTP protocol and Apache? You can use --port-share as suggested by @MikeB, but it can't be guessed from your post if that is what you want. In general, you should avoid running OpenVPN on TCP, use UDP instead, so whatever your problem with mixing Apache httpd and OpenVPN is, it will be gone anyway. Nov 21, 2015 at 22:45

2 Answers 2

2

OpenVPN configuration has a port-share directive. It allows OpenVPN to listen on port 443. It detects the type of traffic. If it's VPN traffic, proccesses it. If it's http, redirects it to a designated server.

From OpenVPN documentation:

--port-share host port [dir] When run in TCP server mode, share the OpenVPN port with another application, such as an HTTPS server. If OpenVPN senses a connection to its port which is using a non-OpenVPN protocol, it will proxy the connection to the server at host:port. Currently only designed to work with HTTP/HTTPS, though it would be theoretically possible to extend to other protocols such as ssh. dir specifies an optional directory where a temporary file with name N containing content C will be dynamically generated for each proxy connection, where N is the source IP:port of the client connection and C is the source IP:port of the connection to the proxy receiver. This directory can be used as a dictionary by the proxy receiver to determine the origin of the connection. Each generated file will be automatically deleted when the proxied connection is torn down.

1

It sounds like both Apache and OpenVPN are trying to bind to port TCP/443.

Changing OpenVPN's configuration to use an alternate port would likely solve the conflict. OpenVPN, by default, listens on UDP/1194.

If you are able to add an additional IP address to your server, configure Apache to bind to TCP/443 on the first IP, and OpenVPN to TCP/443 on the second IP.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .