Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I got server setup with nginx+php-fpm and mysql. I have another server with only installed php-fpm, so wanted to use as load balance. But when I am using this dedicated server with php-fpm as load balancer, I got an error when opening page: "Access denied."

/etc/nginx/nginx.conf

user www-data;
worker_processes  3;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_names_hash_bucket_size 64;
    access_log  /var/log/nginx/access.log;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;

    #gzip                on;

upstream php {
server dedicatedserverip:9000;
}

include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-enabled/site.org.conf

server {
        listen   81;
        server_name site.org www.site.org;
        access_log  /var/log/nginx/site.org.log;
        error_log  /var/log/nginx/site.org.log;
root /home/www/site.org;
index  index.php;




   location ~ .php$ {
      fastcgi_pass php;
      fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME    /home/www/$fastcgi_script_name;
        }


} 

Why did I get this error? When I change only the fastcgi_pass to 127.0.0.1:9000 - all work fine.

share|improve this question

2 Answers 2

I recompiled all php. If need some tutorial http://docs.moodle.org/en/Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm

share|improve this answer

Find your php-fpm configuration (default source install location is /usr/local/etc/php-fpm.conf) and make sure that listen.allowed_clients is set to allow the IP of your Nginx box.

If this doesn't fix it then check your Nginx error log for further details.

share|improve this answer
    
Well, forgot to mention that, that's already done: <value name="listen_address">9000</value> <valuename="allowed_clients">127.0.0.1,dedicatedip,nginxip</value> There is nothing useful in logs. –  zion Mar 16 '11 at 18:26
    
I installed another php-fpm using ppa:brianmercer/php repository, I noticed that there is a little bit difference in php-fpm config style than this what i have used. Now after starting I got no errors, only blank page. Seems like php is not working via upstream. Tested with test webserver, php is running fine on localhost, but via upstream - he is showing blank page, like he don't process the php files. –  zion Mar 16 '11 at 20:17
    
Usually a blank page is a nginx no input file specified error that's just not displayed if there are no errors in the php logs. Are you sure the PHP files are located on the remote server in the path you pass in SCRIPT_FILENAME? –  Martin Fjordvald Mar 16 '11 at 20:32
    
I am kinda shure, that it is the correct path, if change the fastcgi_pass php to fastcgi_pass 127.0.0.1:9000 all works fine, but when using upstream - it's shows blank. –  zion Mar 16 '11 at 21:08
1  
That's not what I mean. Your remote server needs the PHP files in the same directory as your local server. Are you sure that both servers have the files in the right directory? –  Martin Fjordvald Mar 17 '11 at 1:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.