title: How do I configure nginx to put its error.log file somewhere I have write privileges?
body: <p>I assume I simply have to insert an entry into an <code>nginx.conf</code> file to resolve the error that is plaguing me (see below), but so far I haven’t had any luck figuring out the syntax.  Any help would be appreciated.</p>
  
  <p>I want to run nginx as a regular user while having installed it using homebrew as a user with administrative privileges.  nginx is trying to write to the <code>error.log</code> file at <code>/usr/local/var/log/nginx/error.log</code>, which it cannot because my regular user lacks write privilege there.</p>
  
  <p>Another wrinkle is coming from the fact that there are two <code>nginx.conf</code> files, a global and a local, and as far as I can tell they are both being read.  They are in the default homebrew location  <code>/usr/local/etc/nginx/nginx.conf</code> and my local project directory <code>$BASE_DIR/nginx.conf</code>.</p>
  
  <p>Here is the error that is generated as nginx attempts to start up:</p>
  
  <pre><code>[WARN] No ENV file found
  10:08:18 PM web.1 |  DOCUMENT_ROOT changed to 'public/'
  10:08:18 PM web.1 |  Using Nginx server-level configuration include 'nginx.conf'
  10:08:18 PM web.1 |  4 processes at 128MB memory limit.
  10:08:18 PM web.1 |  Starting php-fpm...
  10:08:20 PM web.1 |  Starting nginx...
  10:08:20 PM web.1 |  Application ready for connections on port 5000.
  10:08:20 PM web.1 |  nginx: [alert] could not open error log file: open() "/usr/local/var/log/nginx/error.log" failed (13: Permission denied)
  10:08:20 PM web.1 |  2017/03/04 22:08:20 [emerg] 19557#0: "http" directive is duplicate in /usr/local/etc/nginx/nginx.conf:17
  10:08:20 PM web.1 |  Process exited unexpectedly: nginx
  10:08:20 PM web.1 |  Going down, terminating child processes...
  [DONE] Killing all processes with signal  null
  10:08:20 PM web.1 Exited with exit code 1
  </code></pre>
  
  <p>Any help figuring out how to get nginx up and running so I can back to the development side of this project will be much appreciated.</p>