问题描述
我有以下问题.在Ubuntu上安装Apache 2.4.7.我在目录/etc/apache2/sites-available/
I have a following problem.Install Apache 2.4.7 on Ubuntu.I created file in directory /etc/apache2/sites-available/
<VirtualHost ooo.net:80>
ServerName ooo.net
ServerAlias www.ooo.net
ServerAdmin [email protected]
DocumentRoot /home/user/ooo/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
在主机中
127.0.0.1 ooo.net
127.0.1.1 pc
我访问了ooo.net,看到了以下结果
I visited ooo.net and saw following result
禁止您无权访问此服务器上的/.位于本地主机端口80的Apache/2.4.7(Ubuntu)服务器
ForbiddenYou don't have permission to access / on this server.Apache/2.4.7 (Ubuntu) Server at localhost Port 80
我在做什么错了?
error.log-
error.log -
[Sat Apr 12 19:30:57.276525 2014] [core:error] [pid 1213:tid 140219565360896] (13)Permission denied: [client 127.0.0.1:37136] AH00035: access to / denied (filesystem path '/home/user/ooo') because search permissions are missing on a component of the path
[Sat Apr 12 19:30:57.539816 2014] [core:error] [pid 1213:tid 140219556968192] (13)Permission denied: [client 127.0.0.1:37136] AH00035: access to /favicon.ico denied (filesystem path '/home/user/ooo') because search permissions are missing on a component of the path
access.log-
access.log -
127.0.0.1 - - [12/Apr/2014:19:30:57 +0400] "GET / HTTP/1.1" 403 495 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36"
127.0.0.1 - - [12/Apr/2014:19:30:57 +0400] "GET /favicon.ico HTTP/1.1" 403 505 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/33.0.1750.152 Chrome/33.0.1750.152 Safari/537.36"
ls -ltr第一个答案后-
ls -ltr after first answer -
drwxr-sr-x 2 user www-data 4096 апр. 10 20:41 errors
-rwxr-sr-x 1 user www-data 9062 апр. 10 20:41 about.htm
-rwxr-sr-x 1 user www-data 7116 апр. 10 20:41 admin.htm
-rwxr-sr-x 1 user www-data 2884 апр. 10 20:41 admin_art.inc
-rwxr-sr-x 1 user www-data 367112 апр. 10 20:41 ARIAL.TTF
-rwxr-sr-x 1 user www-data 4767 апр. 10 20:41 admin_d2.inc
-rwxr-sr-x 1 user www-data 2958 апр. 10 20:41 admin_exb.inc
-rwxr-sr-x 1 user www-data 2369 апр. 10 20:41 admin_faq.inc
-rwxr-sr-x 1 user www-data 1846 апр. 10 20:41 admin_fbk.inc
-rwxr-sr-x 1 user www-data 1791 апр. 10 20:41 admin_fbk2.inc
-rwxr-sr-x 1 user www-data 2657 апр. 10 20:41 admin_gbk.inc
-rwxr-sr-x 1 user www-data 3881 апр. 10 20:41 admin_frm.inc
-rwxr-sr-x 1 user www-data 2616 апр. 10 20:41 admin_gbl.inc
-rwxr-sr-x 1 user www-data 8197 апр. 10 20:41 admin_img.inc
-rwxr-sr-x 1 user www-data 7352 апр. 10 20:41 admin_new.inc
推荐答案
问题在于,从2.4.3版本开始,Apache的默认配置更具限制性.默认情况下,默认文档根目录之外的目录是禁止的,必须显式启用.请参阅:在Ubuntu 13.10上安装Apache Web服务器
The problem relies in the fact that Apache default configuration is a bit more restrictive from 2.4.3 onwards. Directories outside the default Document Root are prohibited by default and have to be enabled explicitly. See: Install Apache web server on Ubuntu 13.10
基本上,您应该添加:
Require all granted
在Directory指令下的某个地方.
Underneath somewhere under the Directory directive.
这篇关于在Ubuntu 14.04上安装Apache 2.4.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!