第一次使用Linux安装apache,遇到一些问题,记录如下(其实主要是缺少相关联的文件):
(
Linux环境:Ubuntu 12.10
apache:httpd-2.4.7.tar.gz安装apache的过程中需要的一些其他软件:
apr-1.5.0.tar.gz
apr-util-1.5.3.tar.gz
pcre-8.34.tar.gz
)
apr,apr-util,pcre这三个软件缺少任何一个,在configure的过程中都会出错,显示相应的文件找不到,最好先把他们一次性安好,然后在进行configure。具体的命令如下:
./configure --prefix=A --with-apr=B --with-apr-util=C --with-pcre=D --enable-so
其中A,B,C,D分别代表你的apache,apr,apr-util和pcre的安装路径。
不过在我的安装过程中又出现了下面的错误:
config.status: error: cannot find input file: ap_config_auto.h.in
这个问题我清楚是怎么产生的,网上有的说是他移动了apache的文件夹,导致这个文件丢失,可是我并没有移动过这个文件但还是有这个错误。解决方法就是重新解压一个apache的httpd-2.4.7.tar.gz文件,把include中的ap_config_auto.h.in文件复制到进行configure的文件夹中的include文件夹就可以正常进行了。
然后进行
make
make install
安装顺利完成
安装完成后,运行./apachectl start时出现如下错误:
tarting httpd: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
vim httpd.conf,找到ServerName这一行,发现它被注释掉了,改成这样即可:
ServerName localhost:80
就在我以为终于可以正常启动时,又出现错误了:
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
网上下面这个链接说的比较清楚
http://hi.baidu.com/phpython/item/a6fb8d4d3d6d9caede2a9ff2
不过并没有解决我的问题……我用root又启动了一下,竟然启动成功了!终于看到了
"It works!"
激动啊!!!应该是我的权限没有设置清楚导致的。
至此apache安装终于完成了。