程序员的知识教程库

网站首页 > 教程分享 正文

安装Apache-php项目运行的lamp环境搭建

henian88 2024-10-27 10:10:33 教程分享 4 ℃ 0 评论

lamp = linux + apache + mysql + php

首先来讲一下搭建Apache的过程。

Apache编译安装之前,需要先安装依赖apr, apr-util。安装apr-util之前需要先安装apr。 这里说明一下,软件的安装路径


准备安装之前的环境

通过yum安装一些依赖的库,及软件

>>>yum install -y epel-release

>>>yum install -y gcc wget make libtool expat-devel pcre-devel openssl-devel libxml2-devel

安装apr

>>>wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.7.0.tar.gz

>>>tar -zxvf apr-1.7.0.tar.gz

>>>cd apr-1.7.0

>>>./configure --prefix=/usr/local/apr

>>>make

>>>make install

安装apr-util

>>>wget http://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz

>>>tar -zxvf apr-util-1.6.1.tar.gz

>>>cd apr-util-1.6.1

>>>./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

>>>make

>>>make install

安装Apache

>>>wget http://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.39.tar.gz

>>>tar -zxvf httpd-2.4.39.tar.gz

>>>cd httpd-2.4.39

>>>./configure --prefix=/usr/local/apache \--with-apr=/usr/local/apr \--with-apr-util=/usr/local/apr-util \--enable-so \--enable-ssl \--enable-cgi \--enable-rewrite \--with-pcre \--with-zlib \--with-mpm=event \--enable-modules=most \--enable-mpms-shareds=all$ make$ make install

验证是否安装成功

启动Apache

>>>cd /usr/local/apache

>>>./bin/httpd -k start

Apache成功启动之后,运行netstat -tunlp | grep httpd是能够看到处于监听状态的httpd进程. 或者通过浏览器访问http://your_ip, 能够得到一个Apache返回的页面

注意:安装成功之后,可能会访问不了,此时需要关闭防火墙。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表