首页 > 其他 > 详细

ubuntu下apache配置的几个问题

时间:2014-01-23 20:20:41      阅读:435      评论:0      收藏:0      [点我收藏+]

在ubuntu下装了apt-get install安装了apache+php,装完后发现ubuntu下apache的配置文件httpd.conf为空,上网查后才知有个主要的配置文件在/etc/apache2/apache2.conf。但是里面少了很多配置选项,然后又知道原来有许多配置文件,都在/etc/apache2目录下。

装完后,首先遇到是无法自动方位目录主页的问题。自己随便写了个php脚本并命名为index.html,内容大概如下:

<?php

  echo "我十一个兵,来自老百姓!";

?>

保存在/var/www里面,但是在浏览器地址栏中输入localhost却无法访问,浏览器显示空白。以为是DirectoryIndex设置的问题,但是找不到在哪个设置文件中,于是上网搜索答案,找到一个好办:

grep -iR DirectoryIndex /etc/apache2

/etc/apache2/mods-enabled/dir.conf:          DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
/etc/apache2/mods-available/dir.conf:          DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
看来不是这个问题,后面才想起来这是index.html的内容不能只有php脚本,所以改成常规的html,终于可以了,但是后面有发现中文显示乱码,于是上网找到关于字符集设置文件为/etc/apache2/conf.d/charset,vim该文件,去掉AddDefaultCharset前面的#号,restart apache,终于正常显示了。

ubuntu下apache配置的几个问题

原文:http://www.cnblogs.com/beita/p/3530979.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!