Linux 安装Apache 记录

来源:互联网 发布:知乎怎么看阅读量 编辑:程序博客网 时间:2024/06/06 05:24

linux下Apache源码编译安装


1.下载并安装APR  

官网:http://apr.apache.org/

执行下载命令:wget -c http://mirrors.hust.edu.cn/apache//apr/apr-1.6.2.tar.bz2

执行解压命令 tar -xjvf 文件名

 解压后切换到目录执行命令

配置 :./configure --prefix=/usr/local/apr/

编译:make
安装:make install


2.下载并安装APR unit

执行下载命令:wget -c http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.0.tar.bz2

解压后切换到目录执行命令

./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/
make
make install


3.下载并安装PCRE

http://pcre.org/

解压后切换到目录执行命令

./configure -prefix=/usr/local/pcre

make

make install


4 下载并.安装apache httpd

下载 Apache 源码

下载地址 : http://httpd.apache.org/download.cgi

或者直接执行下载命令 : wget -c http://apache.fayea.com//httpd/httpd-2.4.26.tar.bz2


解压后切换到目录执行命令

./configure --prefix=/usr/local/apache --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util

make

make install


至此apache 安装完成,然后我们进行简单的配置,使外网可以访问


6.启动配置apache远程访问

切换到 /usr/local/apache/conf

vi httpd.conf

修改 serviceName 为 localhost:80

找到include  conf/extra/httpd-vhost.conf 去掉注释


然后打开 conf/extra/httpd-vhost.conf 文件



documentRoot是项目路径 

ServerName是要映射的 访问的域名

配置好这两项就可以初步实现访问了,其他的日志等按需求具体设置

配置好保存后重启服务器就可以从外网访问了




 
原创粉丝点击