1. > 智能数码 >

apache安装(apache安装与配置 linux)

本文目录一览:

Centos 下Apache(httpd) 安装过程

其实,网上这块的部署文章非常多 。随便搜索,都有 。

这篇文章,老徐帮大家挑选几个比较重点的过程 命令 。

1. 有些 linux 版本中已经预置了有Apache,并且已经是服务了,所有首先检查系统中是否已经存在httpd的服务

1)先检查 服务器 上是否已经启动了此服务 。

命令如下

ps -ef|grep httpd

2)查看linux系统服务中有没有httpd

chkconfig --list | grep httpd

3)如果有服务存在,那么需要先关闭httpd服务自启动

命令 chkconfig httpd off

4)停止httpd服务

命令 service httpd stop

5)再次查看,是否有进程存在

命令 ps -ef|grep httpd

6)如果有进程存在,关闭进程

命令 kill -9 pid

1)先检查 安装包 的名字

命令 rpm -qa|grep httpd

pre Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"[root@istester]~# rpm -qa|grep httpd

httpd-2.2.15-69.el6.centos.x86_64

httpd-tools-2.2.15-69.el6.centos.x86_64/pre

2)根据安装包名字删除包

rpm -e httpd-tools-2.2.15-69.el6.centos.x86_64

rpm -e httpd-2.2.15-69.el6.centos.x86_64

3)删除httpd.conf文件

pre class="prettyprint" Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"#先检查文件在哪

find / -name httpd.conf

rm /xxx/xxx/httpd.conf/pre

3. 准备事项已完成,剩下的就是常规安装了 。

注:我们通过yum的方式,在线安装,非常简单 。

1)检查是否存在httpd包

pre Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"[www@istester ~]$ yum list httpd

Loaded plugins: security

base | 3.7 kB 00:00

epel | 4.7 kB 00:00

epel/primary_db | 6.0 MB 00:00

extras | 3.4 kB 00:00

extras/primary_db | 28 kB 00:00

updates | 3.4 kB 00:00

updates/primary_db | 3.2 MB 00:00

Available Packages

httpd.x86_64 2.2.15-69.el6.centos base/pre

2、安装Apache

yum install httpd

pre Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"Total 20 MB/s | 932 kB 00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 1/4

Updating : httpd-tools-2.2.15-69.el6.centos.x86_64 2/4

Installing : httpd-2.2.15-69.el6.centos.x86_64 3/4

Cleanup : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4

Verifying : httpd-tools-2.2.15-69.el6.centos.x86_64 1/4

Verifying : httpd-2.2.15-69.el6.centos.x86_64 2/4

Verifying : apr-util-ldap-1.3.9-3.el6_0.1.x86_64 3/4

Verifying : httpd-tools-2.2.15-53.el6.centos.x86_64 4/4

Installed:

httpd.x86_64 0:2.2.15-69.el6.centos

Dependency Installed:

apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1

Dependency Updated:

httpd-tools.x86_64 0:2.2.15-69.el6.centos

Complete!/pre

安装过程,不用理会,如果看到如上提示,说明安装成功了。

3、设置Apache服务的启动级别

chkconfig --levels 235 httpd on

Apache是一个服务,所以,可以通过设置服务的启动级别来让它启动。

4、启动服务

两种方式,

1)如下 /etc/init.d/httpd start

2)如下

service httpd start

5、查看服务是否正常启动

两种方式,

1)查看服务状态

pre Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"[root@istester www]# service httpd status

httpd (pid 10339) is running.../pre

2)查看进程

pre Courier New", monospace; font-size: 12px; white-space: pre-wrap; display: block; padding: 9.5px; margin: 0px 0px 10px; line-height: 1.38462; color: rgb(51, 51, 51); word-break: break-all; overflow-wrap: break-word; background-color: rgb(245, 245, 245); border: 1px solid rgb(204, 204, 204); border-radius: 4px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"[root@istester www]# ps -ef|grep httpd | grep -v grep

root 10339 1 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10341 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10342 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10343 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10344 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10345 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10346 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10347 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd

apache 10348 10339 0 23:15 ? 00:00:00 /usr/sbin/httpd/pre

补充,

1)停止服务

service httpd stop

2)重启服务

service httpd restart

6、安装之后的说明:

1)验证是否安装成功

现在打开 地址,看看有没有Apache的默认页面出来了?如果有就对了。

2)安装目录说明

Apache默认将网站的根目录指向 /var/www/html

默认的主配置文件是 /etc/httpd/conf/httpd.conf

配置存储在的/etc/httpd/conf.d/目录

End

文 / IDO老徐

怎么安装apache服务

方法/步骤

首先在百度里面搜索apache下载。看到第一个是显示的是Download - The Apache HTTP Server Project 对,就是这个,点击进去。

打开下载地址,找到最新的版本,现在看到的版本最新为2.4.10。里面有两个压缩类型的文件。不过是linux的,我们继续向下看。

找到Files for Microsoft Windows,这个是window版本的一个浏览入口,其他地方也是可以到达的。我们点击进入。

进入后我们会在页面中间的位置,看到有一个是Apache Lounge,单词很有意思直译是apache的休息室。点击进去。其他的一些链接是一些集成开发环境和一些插件性质的内容,有兴趣可以点击看看。

我们点击进入休息室,可以看到apache的下载链接。有32位和64位区分。同时我们看到后面有VC11的标志。这个是VC11运行库。我们选择我们想要的版本下载。大小在12.3M左右。我们也可以看到左侧一些其他的版本。

下载完成后,解压下,找到bin目录下面的httpd.exe,执行下,然后地址栏输入localhost默认80端口就可以看到index下面的内容了。

如何在win10上安装apache服务器

工具/原料

windows 7 64位

Apache 2.4.10 服务器软件 (这个下载过程稍后提到)

Apache的下载:

1

登录 这个地址,找到2.4.10,如下图位置:

2

进入如下界面后,选择第一项ApacheHaus,这是个第三方下载平台,在它的网站下载独立的Apache会是一个压缩包

另外四个中,第二个也是独立的Apache下载地址,另外三个是集成开发环境。

小编选的第一个。

3

在新的界面中,会发现VC9和VC11字样,通过阅读相关内容得知,VC9是指用VS2008编译的代码,而VC11是用VS2012编译的,而用VS2012编译的无法在windows xp和server 2003中使用。

算是为了兼容性好点吧,小编选的用VC9编译的64位Apache,选择下载

至此,下载过程完成!

END

安装过程:

1

安装过程很简单,因为是压缩包,所以,先将其解压包中的 Apache24 解压到合适的位置

2

Apache24名称可以根据自己情况改,小编改成“Apache”,

并将其放到了D:\application_software\ 这一目录

END

配置过程:

1

找到D:\application_software\Apache\conf\httpd.conf文件,用记事本打开,找到:Define SRVROOT 这一项,将其右方的值改为

当前你Apache安装存放的目录地址,如下小编所示:

2

继续找,找到:Listene 80

若你的80端口被占用(可在cmd下用命令netstat -a查看),则将80端口改为别的

保存httpd.conf文件。

3

接下来需要配置安装Apache的主服务,有了它,Apache才可启动:

打开CMD窗口,输入:"D:\application_software\Apache\bin\httpd.exe" -k install -n apache

切记,包含引号。该命令的意思是,安装apache服务,并将该服务名称命名为apache(你也可以改成别的),回车。

服务安装完毕,完毕后,会自动测试,若有问题,窗口会提示错误,此时,请根据错误自行排查。

正常安装完毕如下图所示:

其中,Errors reported here must be corrected before the service can be started.意思是,若该句话后面有错误信息,则表示服务安装失败,需要先改正错误。若没有,则成功。

4

在安装目录中,找到D:\application_software\Apache\bin\ApacheMonitor.exe可执行文件,双击运行,桌面右下角会出现图标,双击打开窗口界面,会看到如图所示:

5

点击左侧start,启动apache服务。

补充句,从该界面可看出,其可以手动控制服务的开启与关闭,为了节省资源,关闭Apache服务器的时候,请先点击“Stop”关闭apache服务。

当然,该服务也可以在windows系统服务中关闭(建议设置成手动)

下图显示的是该服务成功显示的状态:

6

打开浏览器,输入访问

若出现如下图所示界面,则Apache服务器的基本配置完毕,此时apache服务器已经可以运行,更具体的配置,需要使用者自行去参悟了。

END

补充:apache服务的卸载

若Apache服务器软件不想用了,想要卸载,需要先卸载apache服务(切记,若直接删除安装路径的文件夹,会有残余文件在电脑,可能会造成不必要的麻烦)

在CMD命令窗口,输入如下(建议先停止服务再删除):

sc delete apache

apache是Apache服务器的服务名

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, website.service08@gmail.com 举报,一经查实,本站将立刻删除。

联系我们

工作日:9:30-18:30,节假日休息