오류 500 우분투 index.php 설정

오류 500 우분투 index.php 설정

내 파일을 html 디렉토리에 넣은 후 이 오류가 발생하며 이 설정에 대해 혼란스럽습니다. 파일 을 열어야 할 것 같은데 index.php500 오류가 발생합니다. 발견한 오류가 있으면 알려주시기 바랍니다.

디렉토리의 구조

여기에 이미지 설명을 입력하세요

다음의 데이터입니다 /etc/apache2/sites-available/fullstack1.conf.

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName www.fullstack1.xyz
    ServerAlias fullstack1.xyz
    DocumentRoot /var/www/html/fullstack1

    <Directory /var/www/html/fullstack1/public/>
        DirectoryIndex index.php
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
     </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    LogLevel warn
</VirtualHost>

다음의 데이터입니다 /etc/apache2/apache2.conf.

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

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

답변1

파일에서 살펴볼 몇 가지 항목이 있는 것 같습니다 fullstack1.conf.

  1. DocumentRoot사이트 방문자가 엔터티를 기반으로 시작하는 디렉터리를 가리켜야 합니다 <Directory>.

    /var/www/html/fullstack1/public
    
  2. 엔터티 의 마지막 슬래시 <Directory>는 필요하지 않습니다.

    <Directory /var/www/html/fullstack1/public>
    
  3. 최신 버전의 Apache를 실행하는 경우 엔터티에서 다음 두 줄을 제거할 수 있습니다 <Directory>.

    Order allow,deny
    Allow from all
    

    이러한 권한 설명은 이제 명령문으로 처리됩니다 Require.

  4. 사람들이 베어 도메인을 방문할 때 Apache가 무엇을 제공해야 할지 모르는 경우 기본적으로 디렉터리 구조를 표시하거나 오류를 표시합니다. PHP 기반 사이트를 실행하는 경우 다음 줄 바로 뒤에 다음 줄을 추가할 수 있습니다 DocumentRoot.

    DirectoryIndex index.php index.html index.htm
    

    index.php이것은 먼저 디렉토리 에서 검색 하고 PHP 파일이 없으면 /public먼저 실패하고 그 다음에는 .index.htmlindex.htm

이러한 항목이 처리되면 Apache 서버를 다시 시작(또는 다시 로드)합니다.

sudo service apache2 restart

이것은 당신에게 필요한 것을 제공할 것입니다

관련 정보