Apach服务基本配置

lamp ======linux  apache  mysql  php
curl  -I  www.yuku.com  ##查看优酷用的什么服务器##


###apache的安装部署
yum  install  httpd  -y  ##apache软件
yum  install  http-manual  ##apache的手册
systemctl  start   httpd  
systemctl  enable  httpd
systemctl  start firewalld
firewall-cmd  --list-all  ##列出火墙信息


firewall-cmd  --permanent  --add-service=http##永远允许http
firewall-cmd  --reload  ##火墙重新加载
1.apchece
企业中常用的的web服务,用来提供http://(超文本传输协议)
/var/www/html     ##apache的/目录,默认发布目录
/var/www/html/index.html   ##apache的默认发布文件
vim    /var/www/html/index.html
<h1>  hello  world  </h1>
:wq
##测试 http://172.25.254.149


        http://172.25.254.100/manual
###apache 的基础信息
##主配置目录     /etc/httpd/conf
###主配置文件    /etc/httpd/conf/httpd.conf
###子配置目录     /etc/httpd/conf.d/
##子配置文件:     /etc/httpd/conf.d/*.conf
默认发布目录          /var/www/html
默认发布文件          index.html
默认端口            80
默认安全上下文      httpd_sys_content_t
程序开启默认用户  apache
apache日志       /etc/httpd/logs/*
###修改默认端口##
vim  /etc/httpd/conf/httpd.conf
修改42行    8080
systemctl  restart  httpd
netstat  -antlupe   |  grep  8080  ##显示端口
firewall-cmd  --permanent  --add-port=8080/tcp    ##增加8080端口的http
firewall-cmd  --reload
测试:172.25.254.149:8080


###默认发布目录的修改##
vim  /etc/httpd/conf/httpd.conf
mkdir  /westos/html  -p
cd  /westos/html
vim  index.html
(hello123)
修改120行  DocumentRoot  "/westos/html"
          <Directory  "/westos/html">  ###默认发布目录
           Require  all  granted   ###提供所有权限
          DirectoryIndex   index.html  ### 默认发布文件
    </Directory>
systemctl  restart  httpd


###修改默认发布文件
默认发布文件就是访问apache时没有指定文件名称时默认访问的文件这个文件可以指定多个,有访问顺序
vim  /etc/httpd/conf/httpd.conf
164    DirectoryIndex   index.html  test.html  ##当index.html不存在时访问test.html
systemctl  restart  httpd

猜你喜欢

转载自blog.csdn.net/weixin_42709236/article/details/81611326