title: OSX - Start and Stopping of Nginx error
body: <p>I install <code>nginx</code> via home brew and when i try to start or stop it i get the following error </p>
  
  <pre><code>➜  ~  sudo nginx -s stop
  nginx: [error] open() "/usr/local/var/run/nginx.pid" failed (2: No such file or directory)
  ➜  ~  sudo nginx
  nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
  nginx: [emerg] bind() to 0.0.0.0:8080 failed (48: Address already in use)
  nginx: [emerg] still could not bind()
  </code></pre>
  
  <p><strong>File structure</strong></p>
  
  <pre><code>➜  ~  /usr/local/var/run
  ➜  run git:(master) ls
  nginx
  ➜  run git:(master) cd nginx
  ➜  nginx git:(master) ls
  client_body_temp fastcgi_temp     proxy_temp       scgi_temp        uwsgi_temp
  ➜  nginx git:(master)
  </code></pre>
  
  <p><strong>To check if nginx is running</strong></p>
  
  <pre><code>➜  ~  ps waux | grep nginx
  harshamv          963   0.0  0.0  2432772    656 s000  S+    1:32PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn nginx
  </code></pre>
  
  <p><strong>When i try to run Nginx i get the following error.</strong></p>
  
  <pre><code>➜  ~  nginx
  nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
  2015/07/02 13:39:44 [emerg] 1074#0: open() "/usr/local/var/log/nginx/access.log" failed (13: Permission denied)
  </code></pre>