title: Nginx 403 Forbidden when running PHP
body: <p>Note: <strong>I didn't Get my answear anywhere That's why I'm making this</strong></p>
  <p>My nginx.conf file:</p>
  <pre><code>#user  nobody;
  worker_processes  1;
  
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  
  #pid        logs/nginx.pid;
  
  
  events {
      worker_connections  1024;
  }
  
  
  http {
      include       mime.types;
      default_type  application/octet-stream;
  
      #log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
      #                  '$status $body_bytes_sent &quot;$http_referer&quot; '
      #                  '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';
  
      #access_log  logs/access.log  main;
  
      sendfile        on;
      #tcp_nopush     on;
  
      #keepalive_timeout  0;
      keepalive_timeout  65;
  
      #gzip  on;
  
      server {
          listen       80;
          server_name  localhost;
  
          #charset koi8-r;
  
          #access_log  logs/host.access.log  main;
  
          location / {
              root   html;
              index index.html index.htm index.php;
          }
  
          #error_page  404              /404.html;
  
          # redirect server error pages to the static page /50x.html
          #
          error_page   500 502 503 504  /50x.html;
          location = /50x.html {
              root   html;
          }
  
          # proxy the PHP scripts to Apache listening on 127.0.0.1:80
          #
          #location ~ \.php$ {
          #    proxy_pass   http://127.0.0.1;
          #}
  
          # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
          #
          location ~ \.php$ {
             root           html;
             fastcgi_pass   127.0.0.1:9000;
             fastcgi_index  index.php;
             fastcgi_param  SCRIPT_FILENAME  C:/nginx/html/$fastcgi_script_name;
             include        fastcgi_params;
          }
  
          # deny access to .htaccess files, if Apache's document root
          # concurs with nginx's one
          #
          #location ~ /\.ht {
          #    deny  all;
          #}
      }
  
  
      # another virtual host using mix of IP-, name-, and port-based configuration
      #
      #server {
      #    listen       8000;
      #    listen       somename:8080;
      #    server_name  somename  alias  another.alias;
  
      #    location / {
      #        root   html;
      #        index  index.html index.htm;
      #    }
      #}
  
  
      # HTTPS server
      #
      #server {
      #    listen       443 ssl;
      #    server_name  localhost;
  
      #    ssl_certificate      cert.pem;
      #    ssl_certificate_key  cert.key;
  
      #    ssl_session_cache    shared:SSL:1m;
      #    ssl_session_timeout  5m;
  
      #    ssl_ciphers  HIGH:!aNULL:!MD5;
      #    ssl_prefer_server_ciphers  on;
  
      #    location / {
      #        root   html;
      #        index  index.html index.htm;
      #    }
      #}
  
  }
  </code></pre>
  <p>I also ran</p>
  <pre><code>php-cgi.exe -b 127.0.0.1:9000
  </code></pre>
  <p>in my command prompt in my C:\PHP</p>
  <p><strong>The error i get is</strong></p>
  <blockquote>
  <p>403 Forbidden
  nginx/1.19.7</p>
  </blockquote>
  <p>in Localhost.</p>
  <p>I don't have a proxy on and I really don't know what the error is
  <em><strong>I noticed that There was a Error file</strong></em>
  So here are the contents of that file :</p>
  <pre><code>2021/03/08 07:13:46 [emerg] 17544#7752: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
  2021/03/08 07:14:04 [emerg] 1160#19796: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
  2021/03/08 07:14:15 [emerg] 15840#20192: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)
  2021/03/08 07:17:55 [error] 17248#19796: *9 CreateFile() &quot;C:\nginx/html/robots.txt&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /robots.txt?448659 HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:25:13 [error] 17248#19796: *41 CreateFile() &quot;C:\nginx/html/phpmyadmin&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /phpmyadmin HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:26:02 [error] 17248#19796: *41 directory index of &quot;C:\nginx/html/Facebook/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET /Facebook/ HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:26:07 [error] 17248#19796: *48 CreateFile() &quot;C:\nginx/html/robots.txt&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /robots.txt?448659 HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:26:48 [error] 17248#19796: *49 CreateFile() &quot;C:\nginx/html/favicon.ico&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /favicon.ico HTTP/1.1&quot;, host: &quot;127.0.0.1&quot;, referrer: &quot;http://127.0.0.1/&quot;
  2021/03/08 07:26:53 [error] 17248#19796: *49 directory index of &quot;C:\nginx/html/Facebook/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET /Facebook/ HTTP/1.1&quot;, host: &quot;127.0.0.1&quot;
  2021/03/08 07:31:00 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:31:00 [error] 17248#19796: *70 CreateFile() &quot;C:\nginx/html/favicon.ico&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /favicon.ico HTTP/1.1&quot;, host: &quot;localhost&quot;, referrer: &quot;http://localhost/&quot;
  2021/03/08 07:31:42 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:31:43 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:31:43 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:32:24 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:32:27 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:32:28 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:32:28 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:32:29 [error] 17248#19796: *70 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:34:07 [error] 17248#19796: *89 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:52 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:52 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:53 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:53 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:53 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:35:54 [error] 17248#19796: *94 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:37:29 [error] 17248#19796: *111 directory index of &quot;C:\nginx/html/&quot; is forbidden, client: 127.0.0.1, server: localhost, request: &quot;GET / HTTP/1.1&quot;, host: &quot;localhost&quot;
  2021/03/08 07:37:29 [error] 17248#19796: *111 CreateFile() &quot;C:\nginx/html/favicon.ico&quot; failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: &quot;GET /favicon.ico HTTP/1.1&quot;, host: &quot;localhost&quot;, referrer: &quot;http://localhost/&quot;
  </code></pre>