Skip to content

Instantly share code, notes, and snippets.

@piffall
Created March 17, 2015 14:21
Show Gist options
  • Save piffall/947a71e42abdae3730c6 to your computer and use it in GitHub Desktop.
Save piffall/947a71e42abdae3730c6 to your computer and use it in GitHub Desktop.
Forwarding Sockets
#!/bin/bash
# Forwarding localhost Web and MySQL Unix-Socket and TCP Socket to other servers with socat
#
# Install:
# sudo apt-get install socat
#
# MySQL
socat UNIX-LISTEN:/var/lib/mysql/mysql.sock,fork,reuseaddr,unlink-early,user=mysql,group=mysql,mode=777 TCP:mysql-server:3306 &
# Apache2
socat TCP-LISTEN:80,fork TCP:apache2-server:80 &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment