【发布时间】:2016-04-27 03:30:37
【问题描述】:
我有一个已经安装了 LAMP 堆栈的 Ubuntu 14.04 服务器。
我有一个目录/home/alex/checkhtml,其中包括一些测试 php 和 html。
我想要的是当我访问http://localhost/checkhtml时,会显示/home/alex/checkhtml的内容(实际上是/home/alex/checkhtml/index.html)
这是我所做的:
- 转到:/etc/apache2/conf-available 并创建
apache-php.conf文件 -
将这些行添加到
apache-php.conf:Alias ^/php "/home/alex/php" <Directory /home/alex/php> Order allow,deny Require all granted </Directory> -
转到 /home/alex/checkhtml 并创建
.htaccess并添加以下行:<FilesMatch "."> Allow from all </FilesMatch> 启用
apache-php.conf并重启apache
但是,当我尝试时:http://localhost/checkhtml。出现错误:
The requested URL /checkhtml was not found on this server.
有谁知道我在这里做错了什么?
谢谢你和最好的问候。
亚历克斯
【问题讨论】:
-
你想访问
/home/alex/checkhtml,但是你已经在apache-php.conf中为路径/home/alex/php创建了规则 -
对不起我的复制和粘贴错误。 Alias ^/checkhtml"/home/alex/checkhtml"
命令allow,deny 要求全部授予