查看“Apache 服务器的安装”的源代码
←
Apache 服务器的安装
跳转至:
导航
,
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
== Apache简介 == Apache版本和主要的特点 官方网站:http://httpd.apache.org Apache简介 Apache是一个知名的Web服务器,是一个开源软件。 Apache的开发人员全部为志愿者,而不含任何商业行为。 Apache Web服务器是使用比例最高的Web服务器。Apache在功能、效率及速度方面居于领先的地位。 Apache Web服务器目录和文件 Apache简介 2007年10月,根据Netcraft公司的调查结果显示Apache是世界上排名第一的WEB服务器。 如下图所示: Apache简介 Apache是一个知名的Web服务器,是一个开源软件。 Apache的开发人员全部为志愿者,而不含任何商业行为。 Apache Web服务器是使用比例最高的Web服务器。Apache在功能、效率及速度方面居于领先的地位。 Apache Web服务器目录和文件 '''Apache Web服务器是在Internet上使用最为广泛,它采用的是B/S结构''' Apache特性 *Apache具有跨平台性,可以运行在UNIX、Linux和Windows等多种操作系统上。 *Apache凭借其开放源代码的优势发展迅速,可以支持很多功能模块。借助这些功能模块,Apache具有无限扩展功能的优点。 *Apache的工作性能和稳定性远远领先于其他同类产品。 == 申请阿里云云主机== *[[申请云主机]] ==远程连接云主机== *[[远程连接云主机]] ==Centos7 安装apache== 运行环境:Centos7 ===安装apache=== 安装apache,并设置开机启动 yum install httpd #安装软件 chkconfig --levels 35 httpd on #设为开机自启 service httpd restart #重新启动软件 <nowiki>Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failed for iZwz9c7pkk6xpht2857qkhZ httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ] </nowiki> ===配置防火墙=== 安装防火墙 yum install firewalld 设置在开机时启用防火墙服务 systemctl enable firewalld.service 查看防火墙状态 systemctl status firewalld 启动防火墙 systemctl start firewalld 增加80端口到防火墙规则 firewall-cmd --permanent --zone=public --add-port=80/tcp 设置HTTP协议服务被允许 firewall-cmd --permanent --zone=public --add-service=http 使最新的防火墙设置规则生效 firewall-cmd --reload 重启防火墙服务 systemctl restart firewalld.service 验证:systemctl status httpd <nowiki>● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2019-10-08 11:02:58 CST; 6min ago Docs: man:httpd(8) man:apachectl(8) Main PID: 26752 (httpd) Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" CGroup: /system.slice/httpd.service ├─26752 /usr/sbin/httpd -DFOREGROUND ├─26753 /usr/sbin/httpd -DFOREGROUND ├─26754 /usr/sbin/httpd -DFOREGROUND ├─26755 /usr/sbin/httpd -DFOREGROUND ├─26756 /usr/sbin/httpd -DFOREGROUND └─26757 /usr/sbin/httpd -DFOREGROUND Oct 08 11:02:58 izbp1bw6yhgsoid4v2o0owz systemd[1]: Starting The Apache HTTP Server... Oct 08 11:02:58 izbp1bw6yhgsoid4v2o0owz httpd[26752]: AH00558: httpd: Could not reliably determine the server's fully...ssage Oct 08 11:02:58 izbp1bw6yhgsoid4v2o0owz systemd[1]: Started The Apache HTTP Server. Hint: Some lines were ellipsized, use -l to show in full. </nowiki> ==Centos6.5安装apache== 运行环境:Centos6.5 ===安装apache=== 安装apache,并设置开机启动 yum install httpd chkconfig --levels 35 httpd on service httpd restart <nowiki>Stopping httpd: [ OK ] Starting httpd: httpd: apr_sockaddr_info_get() failed for iZwz9c7pkk6xpht2857qkhZ httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName [ OK ] </nowiki> ===配置iptables开放80端口=== 开放端口: iptables -I INPUT -p tcp --dport 80 -j ACCEPT service iptables save <nowiki>iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]</nowiki> 重启防火墙: service iptables restart <nowiki>iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ] </nowiki> 查看配置: service iptables status <nowiki>Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination</nowiki> 端口查看方法: <nowiki>[root@iZwz9c7pkk6xpht2857qkhZ ~]# /etc/init.d/iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 Chain FORWARD (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination</nowiki> ==测试== ===添加安全组=== 如果使用了阿里云的服务器,除了上述之外,还要修改安全组; 具体请见:https://help.aliyun.com/document_detail/25471.html?spm=a2c4g.11186623.2.18.spVBK9 ===测试apache是否正常工作=== 使用地址 http://[虚拟机IP] 在物理机浏览器上访问应该能看到如下画面: [[文件:1-8.png]] '''思考:''' '''Apache服务器(httpd)的服务如何查看状态、如何开启、如何停止、如何重启 ?''' ===上传网页=== 将我们自己的网页文件,如Index.html文件, 上传到/var/www/html目录下, 通过浏览器输入:http://虚拟机网址 即可访问 验证
返回至
Apache 服务器的安装
。
导航菜单
个人工具
登录
命名空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
帮助
工具
链入页面
相关更改
特殊页面
页面信息