amanokenji
amanokenji

Reputation: 13

nginx server + php-fpm server = file not found

i apologize for my english first and i cant put link.
here is my situation.

-----------------------------------------------------------------------------------------------------------------------------------.

here is my nginx server default.conf

upstream php{
        server 10.21.35.230:9000;
        }
server {
    listen       80;
    server_name  10.21.35.230;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /var/www/html;
        index  index.php index.html index.htm;
    }

    #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   /usr/share/nginx/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           /var/www/html;
        fastcgi_pass   10.21.35.230:9000;
        fastcgi_index  index.php;
        fastcgi_intercept_errors on;
        fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
        include      fastcgi_params;
    }
        #user configuration
        tcp_nodelay off;
        open_file_cache max=1000 inactive=120s;
        open_file_cache_valid 45s;
        open_file_cache_min_uses 2;
        open_file_cache_errors off;
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

-----------------------------------------------------------------------------------------------------------------------------------. here is my php-fpm server www.conf file

; Start a new pool named 'www'.
[nginx]
user = nginx
group = nginx
listen = 10.21.35.230:9000
listen.owner = nginx
listen.group = nginx
listen.mode = 0777
listen.allowed_clients = 10.21.35.228

-----------------------------------------------------------------------------------------------------------------------------------. here is the print screen

Upvotes: 1

Views: 2493

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146630

Php-fpm should not serve static files and in your config it only serves php files. You need to configure a additional block for static files with root defined

something like

location /www {
   root <folder path where /www is located>;
   try_files $uri =404;
}

Upvotes: 1

Related Questions