Expose a Unix socket to the host system from inside from a Docker container

You can communicate the host machine or even two containers using the same socket. In the general case of two containers, you should start the two dockers from the host machine sharing a volume that should be created in the host machine. docker run –name “containerA” -v /var/run/common_socket_dir:/var/run/common_socket_dir… docker run –name “containerB” -v /var/run/common_socket_dir:/var/run/common_socket_dir… Both, … Read more

Is it dangerous to change the value of /proc/sys/net/ipv4/tcp_tw_reuse?

You can safely reduce the time down, but you may run into issues with inproperly closed connections on networks with packet loss or jitter. I wouldn’t start tuning at 1 second, start at 15-30 and work your way down. Also, you really need to fix your application. RFC 1185 has a good explanation in section … Read more

Can’t connect to MySQL using ‘localhost’ but using ‘127.0.0.1’ it’s ok?

One thing you might check is (which requires you to login to the MySQL console) – check to make sure that you have permissions to login to root via localhost. mysql -h 127.0.0.1 -u root -p — Once you have successfully logged in — mysql> select user,host from mysql.user; +——+——————————–+ | user | host | … Read more

Nginx + php5-fpm = “File not found”

You should have a location section to handle PHP requests configured similarly to this: location ~ \.php$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } (The extra try_files resolves a security vulnerability which could allow arbitrary files to be executed as PHP.) In addition, your root should be defined … Read more

How to set up memcached to use unix socket?

You may find that just setting the socket path doesn’t work. Memcached drops privileges before it creates its socket, though after it’s written its PID. It’s common to put the socket in /var/run (e.g. as mysql does), but only root can write there, so create /var/run/memcached and chown it to nobody, then set /var/run/memcached/memcached.sock as … Read more

Configuring Apache 2.4 mod_proxy_wstunnel for Socket.IO 1.0

Use Rewrite conditions to match for this special case: RewriteEngine On RewriteCond %{REQUEST_URI} ^/socket.io [NC] RewriteCond %{QUERY_STRING} transport=websocket [NC] RewriteRule /(.*) ws://localhost:8082/$1 [P,L] ProxyPass /socket.io http://localhost:8082/socket.io ProxyPassReverse /socket.io http://localhost:8082/socket.io NOTE As Mark W noted below. These must be entered at vhost level and not at server or .htaccess level. You can also reference a balancer: … Read more