【发布时间】:2012-01-23 10:16:48
【问题描述】:
我有安装 Lamp 的 Ubuntu 11.10
有些文件我无法从我的网络目录“/var/www”访问
http://localhost/banner/banner.html 我收到一个错误:
禁止您无权访问此服务器上的 /banner/banner.html。 Apache/2.2.20 (Ubuntu) 服务器在 localhost 端口 80
我可以正常访问/var/www/index.php,因为我也可以从我的浏览器正常浏览/var/www/banner
这是一个小小的和平:
a1a4a@A1A4a:~$ ls -l /var/www
total 7088
-rwxrwxrwx 1 root root 916 2011-11-25 20:49 access-controlled.php
-rw-r--r-- 1 root root 22163 2011-12-16 22:28 account_info.php
-rw-r--r-- 1 root root 22126 2011-12-16 22:27 account_info.php~
-rw-r--r-- 1 root root 16585 2011-12-16 21:32 acount_info.php
-rw-r--r-- 1 root root 0 2011-12-16 21:28 acount_info.php~
drwxrwxrwx 5 root root 4096 2011-12-09 23:03 banner
drwxrwxrwx 2 root root 4096 2011-12-09 23:03 css
和
a1a4a@A1A4a:~$ ls -l /var/www/banner
total 20
-rw--w---- 1 root root 2564 2011-11-25 20:51 banner.html
drwx-w---- 4 root root 4096 2011-12-09 23:03 examples
drwx-w---- 2 root root 4096 2011-12-09 23:03 lib
drwx-w---- 4 root root 4096 2011-12-09 23:03 skins
-rw--w---- 1 root root 1431 2011-11-25 20:51 style.css
这是我的配置:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
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 Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
我的“nano /etc/apache2/apache2.conf”被设置为默认...
如何让我的所有 /var/www 文件(文件夹和子文件夹和文件)可以从我的浏览器访问,就像我在使用 Wamp 的 Windows 机器上一样......
P.S:我将把网站托管在我使用 ubuntu 仅用于编码的 Windows 机器上。
【问题讨论】: