配置机:腾讯云服务器,centos7.2

一、安装Apache服务(Apache软件安装包叫httpd)

yum install httpd -y

 

二、开启Apache服务

systemctl start httpd

  

三、设置开机自启Apache服务

systemctl enable httpd

Apache系列:Centos7.2下安装与配置apache

 

 

四、cd var/www/html(apache网页的存放路径,默认下面是没有网页的)

 

五、vi index.html

Apache系列:Centos7.2下安装与配置apache

 

 六、访问网页(访问服务器的话,访问公有ip)

 Apache系列:Centos7.2下安装与配置apache

 

 

相关配置

配置目录及相关配置文件:

服务目录	/etc/httpd
主配置文件	/etc/httpd/conf/httpd.conf
网站数据目录	/var/www/html
访问日志	/var/log/httpd/access_log
错误日志	/var/log/httpd/error_log

  

【httpd安装后各文件的内容及存放位置】

服务脚本:/etc/rc.d/init.d/httpd

运行目录:/etc/httpd

配置文件:/etc/httpd/conf/

            主配置文件:httpd.conf

            扩展配置文件:/etc/httpd/conf.d/*.conf

socket:

        http: 80/tcp,

        https: 443/tcp

网页文件目录(DocumentRoot):

静态页面:/var/www/html

动态页面(CGI): /var/www/cgi-bin/

默认主页面:index.html  index.php

  

 

 

常见主配置文件(/etc/httpd/conf/httpd.conf)配置参数:

ServerRoot	服务目录
ServerAdmin	管理员邮箱
User	运行服务的用户
Group	运行服务的用户组
ServerName	网站服务器的域名
DocumentRoot	网站数据目录
Listen	监听的IP地址与端口号
DirectoryIndex	默认的索引页页面
ErrorLog	错误日志文件
CustomLog	访问日志文件
Timeout	网页超时时间,默认为300秒.
Include	需要加载的其他文件

  

 

相关文章:

  • 2020-12-18
  • 2021-11-29
  • 2021-08-13
  • 2021-11-20
  • 2021-12-10
  • 2021-09-28
  • 2021-12-10
  • 2021-11-02
猜你喜欢
  • 2021-04-15
  • 2021-08-08
  • 2021-08-09
  • 2021-04-16
  • 2021-09-12
相关资源
相似解决方案