programing

Ubuntu Server의 Apache 2.4.6: 서버 구성(PHP FPM)에 의해 클라이언트가 거부됨 [PHP 파일 로드 중]

telebox 2023. 8. 5. 10:03
반응형

Ubuntu Server의 Apache 2.4.6: 서버 구성(PHP FPM)에 의해 클라이언트가 거부됨 [PHP 파일 로드 중]

오늘 Ubuntu 서버 13.04(Raring Ringtail) → 13.10(Saucy Salamander)을 업데이트했습니다.

그리고 Apache 2 설치가 중단되었습니다.

다음은 내 구성:

파일error.log

[Fri Oct 18 10:48:07.237170 2013] [:notice] [pid 8292:tid 139804677900160] FastCGI: process manager initialized (pid 8292)
[Fri Oct 18 10:48:07.241185 2013] [mpm_event:notice] [pid 8289:tid 139804677900160] AH00489: Apache/2.4.6 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 configured -- resuming normal operations
[Fri Oct 18 10:48:07.241652 2013] [core:notice] [pid 8289:tid 139804677900160] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 18 10:48:28.313923 2013] [authz_core:error] [pid 8294:tid 139804573181696]   [client 81.219.59.75:3536] AH01630: client denied by server configuration: /usr/lib/cgi-bin/php5-fcgi

파일default.conf

#EU
<VirtualHost *:80>
    #ServerName
    DocumentRoot /var/www/dev_stable

    DirectoryIndex index.php index.html index.htm

    <Directory /var/www/dev_stable>
          Options Indexes FollowSymLinks MultiViews

          AllowOverride all
          Require all granted
    </Directory>
</VirtualHost>

파일mods-enabled/fastcgi.conf

#<IfModule mod_fastcgi.c>
#  AddHandler fastcgi-script .fcgi
# FastCgiWrapper /usr/lib/apache2/suexec
#  FastCgiIpcDir /var/lib/apache2/fastcgi
#</IfModule>


<IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
</Ifmodule>

브라우저를 통해 파일을 로드하려고 하면 다음 메시지가 표시됩니다.

site_name/TEST/

Forbidden

You don't have permission to access /php5-fcgi/TEST/index.php on this server.

제가 그것을 고치려면 무엇을 고쳐야 합니까?

저도 똑같은 문제가 있어요.개발을 위해 로컬 시스템에서 몇 개의 가상 호스트를 실행했습니다.

먼저, 나는 변했습니다./etc/apache2/conf-available/php5-fpm.conf다음을 모두 교체했습니다.

Order Deny,Allow
Deny from all

로.

Require all granted

구성을 사용 가능으로 설정해야 합니다.a2enconf php5-fpm가상 호스트 구성에서도 동일한 작업을 수행하여 교체 작업을 수행했습니다.

보안상의 이유로 이것은 권장되지 않는다고 생각합니다만, 서버를 로컬 용도로만 사용하는 한 저는 서버를 사용할 수 있습니다.

Apache 2.4를 새로 설치할 때 이 문제가 발생했습니다.몇 시간 동안 검색하고 테스트한 결과 마침내 Alias 지시어의 (존재하지 않는) 대상이 포함된 디렉토리에 대한 액세스도 허용해야 한다는 것을 알게 되었습니다.즉, 이것은 저에게 효과가 있었습니다.

# File: /etc/apache2/conf-available/php5-fpm.conf
<IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

    # NOTE: using '/usr/lib/cgi-bin/php5-cgi' here does not work,
    #   it doesn't exist in the filesystem!
    <Directory /usr/lib/cgi-bin>
        Require all granted
    </Directory>
</Ifmodule>

저는 오늘 비슷한 문제에 부딪혔습니다.mod_wsgi) Apache 2.2에서 2.4로의 문제일 수 있습니다.포괄적인 변경 사항 목록은 여기에서 확인할 수 있습니다.

제 경우, 추가적인 추가 작업에 도움이 되었습니다.<Directory>-오류 로그가 불만을 제기하는 모든 경로에 대한 항목을 입력하고 섹션을 다음으로 채웁니다.Require all granted.

그래서 당신의 경우에는 당신이 시도할 수 있습니다.

<Directory /usr/lib/cgi-bin/php5-fcgi>
    Require all granted
    Options FollowSymLinks
</Directory>

폴더에서 구성 파일을 이동해야 했습니다.conf.d폴더로sites-enabled.

대체적으로, 그것은 저에게 효과가 있었지만, 저는 그것이 당신의 경우에도 효과가 있다는 것을 보장하지 않습니다.

저는 최근에 같은 문제에 부딪혔습니다.가상 호스트를 다음에서 변경해야 했습니다.

<VirtualHost *:80>
  ServerName local.example.com

  DocumentRoot /home/example/public

  <Directory />
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

받는 사람:

<VirtualHost *:80>
  ServerName local.example.com

  DocumentRoot /home/example/public

  <Directory />
    Options All
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

apache2.conf제안된 Jan Czarny와 같이 <Directory /> AllowOverride None Require all denied </Directory>를 바꾸거나 삭제합니다.

예:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    #Require all denied
    Require all granted
</Directory>

Ubuntu 14.04(Trusty Tahr)에서 작동했습니다.

가상 호스트 파일 이름은 mysite.com .conf여야 하며 이 정보를 포함해야 합니다.

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    ServerName mysite.com
    ServerAlias www.mysite.com

    ServerAdmin info@mysite.com
    DocumentRoot /var/www/mysite

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory "/var/www/mysite">
Options All
AllowOverride All
Require all granted
</Directory>


    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

이 지침에서 "Require all denied"를 "Require all authorized"로 대체하는 것은 아니라고 생각합니다.

<Directory>

    Options FollowSymLinks
    AllowOverride None
    #Require all denied
    Require all granted
</Directory>

Jan Czarny가 제안하고 사용자 3801675가 제안한 것처럼 이 문제를 해결하는 가장 안전한 방법입니다.

Apache 구성 파일에 따르면 해당 줄은 서버의 전체 파일 시스템에 대한 액세스를 거부합니다.가상 호스트 폴더를 교체하면 가상 호스트 폴더에 액세스할 수 있지만 전체 컴퓨터에 액세스할 수 있는 대가를 치르게 됩니다.

Gev Balyan의 접근법이 여기서 가장 안전한 접근법인 것 같습니다.그것은 오늘 아침 새로운 Apache 서버를 설치한 후 저를 괴롭히는 "접근 거부 문제"에 대한 대답이었습니다.

제가 전혀 다른 DocumentRoot 디렉토리를 사용했기 때문에 이 오류가 발생했습니다.

DocumentRoot입니다./var/www/html에서 사한가호서에를 했습니다./sites/example.com

가 링를만습다니었에 ./var/www/html/example.com)로 (으)로/sites/example.com). 이 (으)로 DocumentRoot가 다음으로 설정되었습니다./var/www/html/example.com

그것은 매력적으로 작동했습니다.

시스템을 업그레이드한 후에도 같은 문제가 발생했습니다.저의 경우, 구성 파일을 로드하는 순서로 인해 문제가 발생했습니다./etc/httpd/httpd.conf처음에는 다음과 같이 정의되었습니다.

IncludeOptional conf.d/*.conf
IncludeOptional sites-enabled/*.conf

몇 시간 동안 시도한 후 다음 주문을 시도했습니다.

IncludeOptional sites-enabled/*.conf
IncludeOptional conf.d/*.conf

이제는 잘 작동합니다.

워드프레스에서 wpadmin/setup-config.php 파일 실행을 거부하는 httpd.conf에 다음과 같은 구성이 있었습니다.|-config 부분을 제거하여 문제를 해결했습니다.이 httpd.conf는 plesk에서 가져온 것 같은데 워드프레스에서 제안한 기본 구성일 수도 있습니다.어쨌든 설치가 완료된 후 안전하게 다시 추가할 수 있습니다.

<LocationMatch "(?i:(?:wp-config\\.bak|\\.wp-config\\.php\\.swp|(?:readme|license|changelog|-config|-sample)\\.(?:php|md|txt|htm|html)))">
                        Require all denied
                </LocationMatch>

AWS(Amazon Web Services)를 사용하는 사용자는 SSL 포트(443인 경우)에 대한 규칙을 Security Group에 추가해야 합니다.포트를 여는 것을 잊어버려서 이 오류가 발생했습니다.

3시간 후에 내 머리를 쥐어뜯는 것...

언급URL : https://stackoverflow.com/questions/19445686/apache-2-4-6-on-ubuntu-server-client-denied-by-server-configuration-php-fpm

반응형