Ubuntu 22.04 php8.1-fpm wifth Apache - 403 Forbidden 您無權存取此資源

Ubuntu 22.04 php8.1-fpm wifth Apache - 403 Forbidden 您無權存取此資源

我在 Ubuntu 22.04 上安裝了 php8.1-fpm。原則上,我設定了所有內容,但仍然顯示「403 Forbidden You dot 無權存取此資源」錯誤訊息。該系統在內部網路上配置有用於開發目的的自簽名憑證。

到目前為止我已經用 virtualmin 完成了,但現在我想習慣它......我從那裡購買了配置基礎知識,但顯然仍然缺少一些東西

/etc/apache2/sites-available/mydomain.dev.conf

<VirtualHost 192.168.0.4:443>
    SuexecUserGroup "#1000" "#1000"

    ServerName "mydomain.dev"

    DocumentRoot "/home/mydomain/public_html"

    ErrorLog "/home/mydomain/etc/log/md_error_log"
    CustomLog "/home/mydomain/etc/log/md_access_log" "combined"

    ScriptAlias "/cgi-bin/" "/home/mydomain/etc/cgi-bin/"

    DirectoryIndex index.php index.html

    <Directory "/home/mydomain/public_html">
        Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
        allow from all
        AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
        Require all granted
        AddType application/x-httpd-php .php
        AddHandler fcgid-script .php
        AddHandler fcgid-script .php8.1
        FCGIWrapper /home/mydomain/etc/fcgi-bin/php8.1.fcgi .php
        FCGIWrapper /home/mydomain/etc/fcgi-bin/php8.1.fcgi .php8.1
    </Directory>

    <Directory "/home/mydomain/etc/cgi-bin">
        allow from all
        AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile /home/mydomain/etc/certs/mydomain.dev+4.pem
    SSLCertificateKeyFile /home/mydomain/etc/certs/mydomain.dev+4-key.pem
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    SSLCACertificateFile /home/mydomain/.local/share/mkcert/rootCA.pem
    IPCCommTimeout 31
</VirtualHost>

/home/mydomain/etc/fcgi-bin/php8.1.fcgi

#!bin/bash
PHPRC=$PWD/../etc/php8.1
export PHPRC
unmask 022
PHP_FCGI_CHILDREN=20
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=99999
export PHP_FCGI_MAX_REQUESTS
exec /bin/php-cgi8.1

/etc/mydomain/public_html和子目錄權限:0755 檔案權限:0644

錯誤日誌(沒有鏈接/favicon.ico):

[Mon Apr 25 14:22:06.490822 2022] [core:error] [pid 24678] (13)Permission denied: [client 192.168.0.4:51818] AH00035: access to / denied (filesystem path '/home/mydomain/public_html') because search permissions are missing on a component of the path
[Mon Apr 25 14:22:06.721894 2022] [core:error] [pid 24678] (13)Permission denied: [client 192.168.0.4:51818] AH00035: access to /favicon.ico denied (filesystem path '/home/mydomain/public_html') because search permissions are missing on a component of the path, referer: https://mydomain.dev/

預先非常感謝您的幫助

答案1

將使用者加入 www-data 群組:

usermod -g www-data username

來源:http://www.anoneh.com/208.php

相關內容