title: nginx proxy server localhost permission denied
body: <p>I am just setting up nginx as a webserver that proxies directly to a tomcat app server. 
  When the user connects to my website Nginx should redirect the request to port 8080 where the tomcat app server is running. </p>
  
  <p>I am doing everything on amazon ec2 instance that is running Redhat 7. </p>
  
  <p>What I have so far is this: </p>
  
  <pre><code>nginx.conf file
  
  user nginx;
  worker_processes  1;
  
  server {
   listen 80;
   server_name mydomainname;
   access_log  /var/log/nginx/example.log;
   error_log /var/log/nginx/example.error.log;
  
   location / {
    proxy_pass http://localhost:8080/example/;
   }
  }
  </code></pre>
  
  <p>The error that I am getting is 
  <strong>(13: Permission denied) while connecting to upstream, client</strong></p>
  
  <p>This is definitely a user access issue, but cannot seem to figure it out. It seems like nginx does not have access to redirect to port 8080. </p>
  
  <p>Also, nginx is running under myuser </p>
  
  <pre><code>root     15736   nginx: master process   /usr/sbin/nginx
  myuser  15996   nginx: worker process
  root     16017   grep --color=auto nginx
  </code></pre>
  
  <p>I have tried to put 127.0.0.1 instead of localhost, but no luck. 
  I have also tried to change the user in the nginx.conf to myuser, still no luck. 
  When I connect directly to the application sever I have no issues. </p>
  
  <pre><code>Example URL of my tomcat http://mydomain:8080/example/
  </code></pre>
  
  <p>Thank you in advance. </p>