码迷,mamicode.com
首页 > Web开发 > 详细

Apache 学习笔记

时间:2015-01-28 22:38:35      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:apache

     系统环境:Ubuntu


     1. 查看 apache2 版本

?  ~  apachectl -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Apr  3 2014 12:20:25


     2.重启 apache

#重启 apache
sudo /etc/init.d/apache2 restart
#开启 apache
sudo /etc/init.d/apache2 start
#关闭 apache
sudo /etc/init.d/apache2 stop


     3.开启 htaccess 用于访问控制。打开 apache 配置文件,我的是 /etc/apache2/apache2.conf,因为我的 web 目录在 /var/www 下,所以找到配置文件中的对应目录,并把 AllowOverride 选项改为 All.  AllowOverride 表示允许存在于.htaccess 文件中的指令类型,None 表示不搜索该目录下的.htaccess文件,All 表示在 .htaccess 文件中可以使用所有的指令。

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride All
	Require all granted
</Directory>


    4.重启时出现 AH00558: apache2: Could not reliably determine the server‘s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName‘ directive globally to suppress this message。

     打开配置文件,加上 ServerName 的定义     

#打开配置文件
sudo vim /etc/apache2/apache2.conf

#在其中加上这一句
ServerName localhost:80

     5.重启时出现 (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80

     网上给出了各种方法:

     http://ubuntuforums.org/showthread.php?t=1636667

     http://stackoverflow.com/questions/10160339/starting-apache-fails-could-not-bind-to-address-0-0-0-080

     结果都发现不起作用,因为根本就找不到占用了 80 端口的进程。

     最后发现是因为在 apache2.conf 同一级目录下的 ports.conf, 里面已经有 Listen 80 了,然后在 apache2.conf 里面有

Include ports.conf
     即是包含了 ports.conf 文件,所以是重复定义了,难怪会出错。。。。

     解决方法是:这一句不用写了....或者 Listen 另一个端口

     Ps:假如写了 Listen 23333, Apache 就会为你打开这个端口,不用自己先去打开。


     6. 出现问题 AH00548: NameVirtualHost has no effect and will be removed in the next release
     从 Apache 2.3.11 开始的版本,这一句已经不需要了,删之。。。。


      待续。

Apache 学习笔记

标签:apache

原文地址:http://blog.csdn.net/jcjc918/article/details/41751543

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!