2016-07-28 38 views
0

我試過了所有的東西,並且已經驗證了所有的東西都在同一個組上運行。aws + centos 7 +內置nginx ngx_pagespeed + php-fpm =找不到文件

而且chown'd文件nginx的:nginx的和他們chmod'd 755 這裏是服務器塊

server { 
listen 80; 

root /var/www/example.com/public_html; 
index index.php index.html index.htm; 

server_name example.com; 

location/{ 
      try_files $uri $uri/ /index.php?q=$uri&$args; 
    } 

# Pagespeed main settings 

pagespeed on; 
pagespeed FileCachePath /var/ngx_pagespeed_cache; 

# Ensure requests for pagespeed optimized resources go to the pagespeed 
# handler and no extraneous headers get set. 

location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; } 
location ~ "^/ngx_pagespeed_static/" { } 
location ~ "^/ngx_pagespeed_beacon" { } 

location ~ \.php$ { 
try_files $uri =404; 

fastcgi_split_path_info ^(.+\.php)(/.+)$; 
include fastcgi_params; 
fastcgi_index index.php; 
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
fastcgi_intercept_errors on; 
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
} 
} 
+0

什麼是您試圖訪問的資源?只是http://example.com?如果是這樣,你確定'/ var/www/example.com/public_html'中存在'index.php'嗎? –

+0

我必須分開我試圖訪問的文件,info.php和test.php。 有一個index.html可以正確返回。 FYI php從終端運行。 – etrey

+0

來自nginx錯誤日誌的響應:23820#0:* 11在讀取來自上游的響應頭時,stderr中發送的FastCGI:「主要腳本未知」 – etrey

回答