douza9835 2015-11-06 07:32
浏览 117

nginx + php-fpm问题无法调用文件夹中的其他php文件

I have a nginx and php-fpm config but when i access it from browser, only index.php is getting executed but rest of the files i am not able to call .

nginx config

{
user  nginx;
worker_processes  auto;

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

events {
    worker_connections  1024;
    use epoll;
    multi_accept on;
}

http {
keepalive_timeout 15;
    keepalive_requests 2048;
    server_tokens off;

   upstream php
{
    server unix:/tmp/php-cgi.socket;
   server serverip:9000;
}

 access_log  /var/log/nginx/access.log  main;
include /etc/nginx/conf.d/*.conf;

}

config in /etc/nginx/conf.d/

    server {

        root /var/www/Cachet/public/;
       location / {
     try_files $uri $uri/ /index.php index.php;
    }
        server_name  serverip ; # Or whatever you want to use
        listen 80 default;
        location ~* \.php$ {
                    fastcgi_split_path_info ^(.+\.php)(/.+)$;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_keep_conn on;
                    include fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }




}

These are few lines from error.log and access.log

2015/11/06 12:40:53 [error] 19346#0: *1 FastCGI sent in stderr: "Unable to open primary script: /var/www/Cachet/public/dashboard.php (No such file or directory)" while reading response header from upstream, client: Client IP, server: Server IP, request: "GET /dashboard.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "Server IP"

2015/11/06 12:41:05 [error] 19346#0: *1 FastCGI sent in stderr: "Unable to open primary script: /var/www/Cachet/public/autoload.php (No such file or directory)" while reading response header from upstream, client: Client IP, server: Server IP, request: "GET /autoload.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "Server IP"

  • 写回答

1条回答 默认 最新

  • doudong7256 2015-11-10 04:44
    关注

    since there was no response here then with help from my colleague i was able to find two problem here in config file because of which i was not able to call multiple php files in separate folder ..

    try_files $uri $uri/ /index.php index.php; 
    instead it needed 
    try_files $uri $uri/ /index.php$is_args$args;
    

    Alos since it was not loading the images the line which was missing was include /etc/nginx/mime.types; in location block of conf.d/default.conf.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog