Loading...

Apache基本信息与配置、控制访问

–>

1.apache安装
[[email protected] ~]# systemctl start httpd
[[email protected] ~]# systemctl enable httpd
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
2.apache基本信息
index.html ##默认发布文件

/etc/httpd/conf/httpd.conf ##配置文件
/etc/httpd/conf.d/*.conf

/var/www/html ##默认发布目录

apache默认端口: 80

3.apache的基本配置
修改默认发布文件
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
164 DirectoryIndex test.html ##将默认发布文件修改为test.html
[[email protected] ~]# systemctl restart httpd.service

修改默认发布目录
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
120 DocumentRoot “/westos/www/html”
121

selinux须设置为disable或permissive状态

[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce
Permissive

3.apache的访问控制
–设定ip访问
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
124

html

见前面的练习

php

[[email protected] ~]# yum install php.x86_64 -y
[[email protected] ~]# cat /var/www/html/test.php

cgi

  1. 定义:
    CGI(Common Gateway Interface)是HTTP服务器与你的或其它机器
    上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上。

  2. 功能:
    绝大多数的CGI程序被用来解释处理杰自表单的输入信息,并在服
    务器产生相应的处理,或将相应的信息反馈给浏览器。CGI程序使
    网页具有交互功能。

  3. CGI处理步骤:
    ⑴通过Internet把用户请求送到服务器。
    ⑵服务器接收用户请求并交给CGI程序处理。
    ⑶CGI程序把处理结果传送给服务器。
    ⑷服务器把结果送回到用户。

本文来源 互联网收集,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源,如您发现有涉嫌抄袭侵权的内容,请联系本站核实处理。

© 版权声明

相关文章