# 403 Forbidden, Nignx

**URL:** <https://www.ruby-forum.com/t/403-forbidden-nignx/227665>\
**Category:** NGINX\
**Created:** [March 22, 2013, 9:46pm UTC](https://www.ruby-forum.com/t/403-forbidden-nignx/227665 "2013-03-22T21:46:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yunior\_Miguel\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/dbc845/32.png) [@Yunior\_Miguel\_A](https://www.ruby-forum.com/u/Yunior_Miguel_A)\
**Post date:** [March 22, 2013, 9:46pm UTC](https://www.ruby-forum.com/t/403-forbidden-nignx/227665/1 "2013-03-22T21:46:00Z")

</div>

Hello again:

I am have public a redmine and other aplication with nginx the other  
aplication is make in php, the php aplication have a api direccion for  
some services, when i put the url of de aplication without the api all  
is fine and not hae problem, but when I try to access the application  
using the API URL the following error appears:

```
                        403 Forbidden
                            nginx

```

this is my nginx configuration for de php aplication.

server {  
listen 80;  
server\_name [appphp.nginx.com](http://appphp.nginx.com);  
root /var/www/appphp;  
index index.php, index.html;  
location / {  
include /etc/nginx/proxy\_opts;  
proxy\_redirect off;  
error\_page 404 404.html;  
error\_page 500 502 503 504 500.html;  
access\_log /var/log/nginx/appphp.access.log;  
error\_log /var/log/nginx/appphp.error.log;

```
     #Gzip
     gzip on;
    gzip_min_length 1000;
    gzip_types text/plain text/css application/x-javascript text/xml

```

application/xml application/xml+rss #text/javascript;  
gzip\_disable “MSIE [1-6].”;

```
    charset utf-8;
  }

```

location ~ “^(.+.php)($|/)” {

```
       set $script $uri;
       set $path_info "/";

      if ($uri ~ "^(.+\.php)($|/)") {
      set $script $1;
      }

      if ($uri ~ "^(.+\.php)(/.+)") {
      set $script $1;
      set $path_info $2;
       }

      include /etc/nginx/fastcgi_params;
      fastcgi_pass 127.0.0.1:9000;

      fastcgi_param SCRIPT_FILENAME appphp.nginx.com$script;
      fastcgi_param SCRIPT_NAME $script;
      fastcgi_param PATH_INFO $path_info;
     }

```

}

proxy\_opts configurations:

# Shared options used by all proxies

proxy\_set\_header Host $http\_host;

# Following headers are not used by Redmine but may be useful for

plugins and

# other web applications

proxy\_set\_header X-Real-IP $remote\_addr;  
proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header X-Forwarded-Proto $scheme;

# Any other options for all proxies here

client\_max\_body\_size 10m;  
client\_body\_buffer\_size 128k;

proxy\_connect\_timeout 90;  
proxy\_send\_timeout 90;  
proxy\_read\_timeout 90;

proxy\_buffer\_size 4k;  
proxy\_buffers 4 32k;  
proxy\_busy\_buffers\_size 64k;  
proxy\_temp\_file\_write\_size 64k;
