CentOS 安装 apache

apache在centos7中是Apache HTTP server。如下对httpd的解释就是Apache HTTP Server。所以想安装apache其实是要安装httpd。

[[email protected] ~]# yum install httpd  #安装

[[email protected] ~]# chkconfig httpd on    #设置开机启动

Note: Forwarding request to ‘systemctl enable httpd.service‘.

Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[[email protected] ~]#

[[email protected] ~]# service httpd start    #启动服务

Redirecting to /bin/systemctl start  httpd.service

[[email protected] ~]#

[[email protected] ~]# netstat -ntlp    #查看 80 端口是否启动

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      958/sshd

tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1456/master

tcp6       0      0 :::80                   :::*                    LISTEN      2363/httpd

tcp6       0      0 :::22                   :::*                    LISTEN      958/sshd

tcp6       0      0 ::1:25                  :::*                    LISTEN      1456/master

[[email protected] ~]#

到这里时,在本机是可以访问 web 的,但其他局域网电脑不可以访问 web,此原因是防火墙导致:

[[email protected] ~]# curl 127.0.0.1

开启防火墙:centos的防火墙改成了firewall,不再叫iptables,开放端口的方法如下

[[email protected] ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent

success

[[email protected] ~]#

命令含义:

--zone #作用域

--add-port=80/tcp  #添加端口,格式为:端口/通讯协议

--permanent   #永久生效,没有此参数重启后失效

重启防火墙命令:

[[email protected] ~]# systemctl restart firewalld.service

[[email protected] ~]# systemctl stop firewalld.service

[[email protected] ~]# systemctl start firewalld.service

到这里,局域网电脑就可以访问 web了

时间: 2024-08-11 07:49:12

CentOS 安装 apache的相关文章

Centos 安装Apache软件

检查rpm    -qa    httpd [[email protected] icons]# rpm    -qa   |grep  httpd httpd-2.2.15-30.el6.centos.i686 查看安装路径 rpm -ql httpd-2.2.15-30.el6.centos.i686 确保安装完 [[email protected] icons]#  yum   -y  install      httpd 或者也可以 rpm -qa  httpd rmp -ql http

CentOS安装Apache的FastCGI模块(mod_fastcgi)

网上有很多篇关于Apache的fastcgi模块安装说明的文章,大部分都是基于Apache源码编译的,如果是通过yum install方式安装httpd的话,直接依葫芦画瓢必然会遇到各种各样的编译问题,通过查阅老外写的一些关于CentOS下Apache的FastCGI模块(mod_fastcgi)的安装文档,我大致重新整理了一下. 1. 安装编译相关的依赖包 # yum install httpd-devel apr apr-devel libtool 2. 下载mod_fastcgi源代码 #

Linux CentOS 安装Apache

一.安装Apache yum -y install httpd /etc/init.d/httpd start 文档目录在/var/www/html 二.安装PHP yum -y install php 修改Apache配置文件,/etc/httpd/conf/httpd.conf 对应位置追加以下内容: LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so 追加 AddType application/x-httpd-php .p

CentOS 安装Apache服务

Centos基于Redhat, 通过yum可以安装所需要的软件包. 1. yum -y install httpd , 这个会将httpd安装在 /etc/目录下. 2. 安装成功后,执行以下命令来启动httpd服务 service httpd start 3. 在浏览器中访问, 下面这个IP是我的IP地址,需要替换为你自己的IP地址. http://10.64.246.152/ 会看到如下页面. 看到这个页面就说明apache启动成功了! 4. 要想查看安装的apahche版本,执行以下命令,

[部署]CentOS安装apache

环境 虚拟机:VMWare10.0.1 build-1379776 操作系统:CentOS7 64位 步骤 1.使用yum安装 yum install httpd httpd-devel 2.启动 apachectl start 开机启动服务安装 1.在/etc/init.d目录先建立httpd文件 vi /etc/rc.d/init.d/httpd httpd文件内容 #!/bin/sh # # Startup script for the Apache Web Server # # chkc

阿里云 centos 安装apache和php

mysql使用阿里云的rds httpd服务 1. 安装apr和apr-util 2. 安装 httpd apache.org,apr.apache.org 安装命令: ./configure --prefix=/usr/local/apache  --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/

Centos安装Apache启动错误:

Apache启动错误:httpd.exe: Could not reliably determine the server's fully qualified 在自己电脑配置Apache开发环境问题的时候,可能会遇到apache的启动错误:httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168. x. x for ServerName,这个错误在error.lo

centos 安装apache

1.检查有没有安装过 #rpm -qa httpd 如果没有返回信息,说明没有安装过 2.#yum install httpd 3.#service httpd start #chkconfig httpd on

CentOS yum安装Apache + PHP + Tomcat7 + MySQL

可以参考下文在CentOS安装Apache + PHP + Tomcat7 + MySQL. ------------------------------------------------------------------------------------ Linux平台上用得最多的web环境就是php.Java和MySQL了,会搭建这个环境,就能把很多开源程序跑起来. 作为一个程序猿,虽然并不用精通运维的活,但基本的Linux环境搭建还是要掌握比较好,也方便自己有时调试一些代码.程序.