2016-03-04 23 views
1

我有以下文件夾結構,我的應用程序Nginx的不服務器子文件夾API應用程序(PHP-FPM)

- css 
- app 
- js 
- ... 
- server (codeigniter) 
    -- system 
    -- application 
    -- index.php 
- index.html (angularJS app) 

這是我的nginx.conf

server { 
     listen 80; 
     listen [::]:80; 

     root /var/www/html/myapp.com/public_html; 

     index index.html; 

     server_name myapp.com www.myapp.com; 

     location/{ 
       index index.html; 
     } 

     location /server/ { 
       index /server/index.php; 
       try_files $uri /server/index.php/$uri; 
     } 

     location /twitter/ { 
       index /twitter/index.php; 
       try_files $uri /twitter/index.php/$uri; 
     } 

     location ~ \.php { 
       fastcgi_split_path_info ^(.+?\.php)(/.*)$; 
       fastcgi_pass unix:/var/run/php5-fpm.sock; 
       include fastcgi_params; 
       fastcgi_param PATH_INFO $fastcgi_path_info; 
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

     } 

     #deny access to .htaccess files, if Apache's document root 
     #concurs with nginx's one 
     location ~ /\.ht { 
       deny all; 
     } 
} 

這是我的錯誤繼續得到

2016/03/04 18:26:02 [error] 4577#0: *4 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/users/isLoggedIn HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/" 
2016/03/04 18:26:02 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/categories HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/" 
2016/03/04 18:26:03 [error] 4577#0: *3 FastCGI sent in stderr: "Unable to open primary script: /home/valor/development/myapp.com/public_html/server/index.php (No such file or directory)" while reading response header from upstream, client: 127.0.0.1, server: myapp.com, request: "GET /server/api/products/latest/16 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "myapp.com", referrer: "http://myapp.com/" 

頁面顯示正確我只是可以達到子文件夾中的api資源。 你能幫我解決我做錯了什麼嗎? 如果您需要任何額外的信息的,請讓我知道,我會提供

謝謝

回答

0

基於用戶@ semm0(link) 這可能是一個權限的問題,可能是通過AppArmor的造成的。請查看this answer以查看可能的解決方案。我不想竊取答案,因此連接到它。

編輯:問題現在可能發生在php-fpm配置中。請用你喜歡的編輯器打開/etc/php5/fpm/pool.d/www.conf並取消以下行:

listen.owner = www-data 
listen.group = www-data 
listen.mode = 0660 

,不要忘了重新啓動PHP服務器:

service php5-fpm restart 
相關問題