【问题标题】:aws + centos 7 + built nginx ngx_pagespeed + php-fpm = file not foundaws + centos 7 + 内置 nginx ngx_pagespeed + php-fpm = 找不到文件
【发布时间】: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


【解决方案1】:

学习了有关 SELinux 的教程。我是 CentOS 的新手,所以对所有的安全参数都不熟悉。

https://www.cloudinsidr.com/content/troubleshooting-php-7-tcp-sockets-with-selinux-on-centos-7-rhelfedora/

【讨论】:

    猜你喜欢
    • 2014-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-02
    • 2023-03-07
    • 1970-01-01
    • 2014-12-02
    相关资源
    最近更新 更多