【发布时间】:2016-12-02 10:24:36
【问题描述】:
我已经尝试了所有方法并验证了所有内容都在同一个组上运行。
还将文件 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;
}
}
【问题讨论】:
-
您要访问的资源是什么?只是example.com?如果是这样,您确定
index.php存在于/var/www/example.com/public_html中吗? -
我必须将我尝试访问的文件、info.php 和 test.php 分开。有一个 index.html 可以正确返回。仅供参考 php 从终端工作。
-
来自 nginx 错误日志的响应:23820#0: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream
标签: php amazon-web-services nginx centos mod-pagespeed