nginx -打开流失败:权限被拒绝

bsxbgnwa  于 5个月前  发布在  Nginx
关注(0)|答案(1)|浏览(85)

我尝试在测试服务器上测试网站迁移。原始网站运行在Apache上,但新网站将从Nginx提供服务。
测试服务器(Rocky Linux 9.2)安装了Nginx + mod_security 3 + php + mariadb。它已经用简单的index.php文件进行了测试.
FastCGI在stderr中发送:“PHP消息:PHP警告:未知:无法打开流:无法打开位置:/www/index.php无法打开位置:首页(Permission denied)”while阅读response header from upstream,client:192.168.xxx.xxx,server:test1.home,request:“GET / HTTP/2.0”,upstream:“fastcgi://unix:/run/php-fpm/www.sock:“,host:“192.168.xxx.xxx”open()“/var/www/test1.home/html/favicon.ico”失败(13:Permission denied),客户端:192.168.xxx.xxx,服务器:test1.home,请求:“GET /favicon.ico HTTP/2.0”,主机:“192.168.xxx.xxx”,转发器:“https://192.168.xxx.xxx/”
我尝试禁用SELinux,mod_security,但问题仍然存在。
/etc/nginx/conf.d/test1.home.conf看起来像这样:

server {
        listen 443 ssl http2;
        server_name test1.home www.test1.home;
        keepalive_timeout   70;

        ssl_certificate /etc/nginx/cert/some_cert.crt;
        ssl_certificate_key /etc/nginx/cert/some_private.key;
        ssl_protocols       TLSv1.3;
        ssl_ciphers         HIGH:!aNULL:!MD5;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout  10m;

        modsecurity on;
        modsecurity_rules_file /etc/nginx/modsecurity.conf;

        root /var/www/test1.home/html;
        index index.php index.html;

        try_files $uri $uri/ /index.php?$args;

        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_pass unix:/run/php-fpm/www.sock;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

}

字符串
你能告诉我问题出在哪里吗?谢谢。

eeq64g8w

eeq64g8w1#

好的...我已经找到问题了...这是文件权限问题。在我将拥有用户更改为nginx后,它工作正常。

相关问题