我刚刚部署了LAMP以准备Elgg安装 . 在我部署了apache和php之后,我想通过创建info.php文件来测试我的进度 . 我将文件放在/ var / www /中,并尝试从浏览器访问它只是为了得到一个错误:
Not Found
The requested URL /info.php was not found on this server.
Apache/2.4.7 (Ubuntu) Server at 192.168.0.9 Port 80
当我在/ var / www / html中放置相同的文件时,它工作并显示Apache和php安装设置 . 任何人都可以向我解释为什么?用于教育目的 .
3 回答
Apache Webserver将显示放置到特定位置的文档 . 该位置的根称为文档根 .
例如,如果DocumentRoot设置为
/var/www/html
,那么对http://www.yoursite.com/folder1/yourpage.php
的请求将导致文件/var/www/html/folder1/yourpage.php
被提供给请求客户端在ubuntu中,默认位置是
/var/www
用于服务器root,而在Centos上它是/var/www/html
此更改需要重新启动服务 .
您可以从
/etc/httpd.conf
更改此位置,其中有一个关于文档根目录的部分 .但是你的发行版再次出现在u33ntu下面
/etc/apache2/http.conf
基于Debian的系统
Apache的默认DocumentRoot是/ var / www / html . 编辑位于
/etc/apache2
目录中的httpd.conf配置文件,并将DocumentRoot更改为/ var / www因为
/var/www/html
是apache的默认文档根路径 . 您可以在/etc/apache2/sites-available/default.conf
中编辑路径 . 找到DocumentRoot为