nginx - phppgadmin - *1 access forbidden by rule

doniyor picture doniyor · Mar 21, 2015 · Viewed 14.1k times · Source

I want to setup phppgadmin, postgresql is already - done by following this article

but I have nginx,

I did so far these configs:

ln -s /usr/share/phppgadmin /var/www

and

/etc/nginx/sites-available/phppgadmin:

server{
    listen 85;
    server_name     pgadmin.mypage.com;
    root            /var/www/phppgadmin;
    index index.html index.html index.php;

    access_log      /var/log/phppgadmin/access.log;
    error_log       /var/log/phppgadmin/error.log;

    location / {
            allow   my_page_IP;
            deny    all;
    }
    location ~ /\.ht {
            deny all;
    }

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /var/www/phppgadmin$fastcgi_script_name;
            include /etc/nginx/fastcgi_params;
    }
 }

and

ln -s /etc/nginx/sites-available/phppgadmin /etc/nginx/sites-enabled/

and

service nginx restart

but I am getting:

403 Forbidden

the error.log says:

2015/03/21 18:06:14 [error] 16916#0: *1 access forbidden by rule, client: 188.194.97.247, server: pgadmin.mypage.com, request: "GET / HTTP/1.1", host: "my_page_IP:85"

I did:

chmod -R 775 phppgadmin/ 
chown -R www-data:www-data phppgadmin/

but still the same 403 message. what am I doing wrong?

Answer

P0pR0cK5 picture P0pR0cK5 · Apr 28, 2017

Access forbidden by rule mean that the access of the desired page was dropped by rule you have put in your configuration.

Just try to remove rule on each location to see which is cause problem.