Linux下Apache服务器的安装与配置
title: Linux下Apache服务器的安装与配置
date: 2019-04-07 20:39:17
categories:
- Linux
tags: - Apache
安装
在linux
中,Apache
服务器叫做httpd
。
准备
首先下载httpd
与httpd
的依赖软件。
-
Apache HTTP Server
-
APR和APR-Util
-
PCRE
没有gcc/gcc-c++
的话,先安装gcc/gcc-c++
[[email protected] /]# yum install gcc-c++
基于centos,其余系统相应变化。
先确定服务器是否联网,若安装过程出现错误,可能是缺某些依赖包,谷歌百度下,会有结果的。
安装
解压
tar -zxf apr-1.6.5.tar.gz
tar -zxf apr-util-1.6.1.tar.gz
tar -zxf pcre-8.38.tar.gz
tar -zxf httpd-2.4.37.tar.gz
默认解压到当前目录
安装
以下命令直接复制粘贴,但具体目录修改为你自己的目录。
- apr的安装
cd apr-1.6.5
./configure --prefix=/home/apr-1.6.5
make
make install
- apr-util的安装
cd ../apr-util-1.6.1
./configure --prefix=/home/apr-util --with-apr=/home/apr-1.6.5/bin/apr-1-config
make
make install
- pcre的安装
cd ../pcre-8.38
./configure --prefix=/home/pcre-8.38 --with-apr=/home/apr-1.6.5/bin/apr-1-config
make
make install
- httpd的安装
cd ../httpd-2.4.18
./configure --prefix=/home/httpd-2.4.37 --with-pcre=/home/pcre-8.38 --with-apr=/home/apr-1.6.5 --with-apr-util=/home/apr-util-1.6.1
make
make install
检查
安装成功。
配置
想要将httpd
作为文件服务器,需要更改一些配置。
- 进入
httpd
的conf
文件夹。
/home/httpd-2.4.37/conf
- 打开
httpd.conf
配置文件。
vi httpd.conf
- 更改端口号
- 更改主机号
- 更改文件目录
- 检查
出现此页面,则安装成功。