
우분투 12.04가 있습니다. apache의 문서 루트에 파일이 있지만 index.html
브라우저에서 문서 루트에 액세스하면 apache가 모든 파일을 나열합니다.
index.html
내가 그것으로 교체하면 잘 작동합니다 index.php
.
내 거 /etc/apache2/sites-enabled/000-default
:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/test/www
<Directory /home/test/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
나는 가지고있다 /etc/apache2/mods-enabled/dir.conf
:
<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>
index.html
검색을 많이 했지만 왜 작동하지 않고 브라우저에 나열되는지 모르겠습니다 .
이 두 파일(index.html 및 index.php)을 유지하면 index.php가 제대로 작동합니다.
출력은 다음과 같습니다 ls -l /home/test/www
.
total 1816236
-rw-r--r-- 1 root www-data 3 Jun 3 10:09 index.html
-rw-r--r-- 1 ubuntu www-data 53 Mar 4 16:55 index.php
drwxrwsr-x 5 ubuntu www-data 4096 May 12 05:03 lifetimeholidays
-rw-r--r-- 1 root www-data 1859796992 May 29 10:32 magentolive17_4_2014.zip
drwxrwsr-x 15 ubuntu www-data 4096 May 28 15:22 railsapp
drwxr-sr-x 15 root www-data 4096 May 28 17:15 railsapp1
drwxrwxr-x 2 ubuntu www-data 4096 Apr 29 09:05 var
답변1
.htaccess
서류를 가지고 있나요 /home/test/www/
? 이 AllowOverride All
섹션에서는 이 디렉터리에 대한 Apache 동적 구성 파일인 파일을 읽을 수 있습니다. 그 내용은 다룹니다 /etc/apache2/sites-enabled/000-default
.