多语言展示
当前在线:1291今日阅读:195今日分享:41

Linux中apache服务器的安装,设置自启动

安装的2.4.7版本
工具/原料
1

Xshell

2

VMware

方法/步骤
1

安装apache cd /lamp/httpd-2.4.7 ./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared回车后,如果遇到如下提示:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.说明这个软件包没有被发现,你需要下载这个包然后安装到./srclib/这个目录里面#如果报错,则:tar  zxvf  apr-1.4.6.tar.gztar  zxvf  apr-util-1.4.1.tar.gz  解压过cp  -r  /lamp/apr-1.4.6  /lamp/httpd-2.4.7/srclib/aprcp  -r  /lamp/apr-util-1.4.1  /lamp/httpd-2.4.7/srclib/apr-util#解压apr和apr-util,复制并取消版本号configure: error: pcre-config for libpcre not found. PCRE is required and available from#如果报错,则:tar zxvf pcre-8.34.tar.gzcd /lamp/pcre-8.34  ./configure && make && make install命令行也可以使用逻辑运算符A && B A执行正确的时候执行第二个A || BA执行错误的时候执行第二个

2

安装完成之后启动Apache测试:/usr/local/apache2/bin/apachectl start

3

查看是否有80端口

4

设置Apache系统引导时启动:echo '/usr/local/apache2/bin/apachectl start' >> /etc/rc.d/rc.local

5

查看一下是否写入成功tail /etc/rc.local

推荐信息