October 17, 2017

Docker: `Cannot start service nginx`

While developing amongst many projects, you may encounter this error when using docker; more specifically docker-compose: ERROR: for {container_name} Cannot start service nginx: driver failed programming external connectivity on endpoint {container_name} ({hash}): Error starting userland proxy: Bind for unexpected error (Failure EADDRINUSE) As a MAC user, the fix is simply to disable the locally running apache instance, allowing docker to forward port 80 locally from the nginx container (in my case).

March 1, 2017

CORS API supporting Symfony3 + Angular2

Is your API giving you trouble with a missing Access-Control-Allow-Origin header error? Perhaps you enjoy living on the bleeding edge, and you’ve decided to build an app with Symfony3 + Anglar2 and you’ve seen this before? XMLHttpRequest cannot load http://myapp.dev. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:4000′ is therefore not allowed access. After many days of stressing and confusion I’ve identified what I believe to be the “easiest” solution to this problem, specifically if you’re using nginx. Install nginx-extras (Debian/Ubuntu)

Configure NGINX

Failed Solutions I attempted nelmio/cors-bundle with limited success and various odd issues. Particularly the response would come back successful, but the browser would still…

February 9, 2016

Ansible NGINX role

As part of my ongoing love affair with Ansible I’ve written a simple NGINX role for use in some pet projects. https://github.com/litwicki/ansible-nginx