zoukankan      html  css  js  c++  java
  • Linux中Apache服务器的简单配置

    配置Apache服务器:

    1.安装Apache,可以参考Linux 中yum的配置来安装:

    yum install http* -y

    2.修改SELinux:

    setenforce 0

    查看:

    3.防火墙开放httpd服务

    firewall-cmd --permanent --add-service=httpd

    重启防火墙:

    firewall-cmd --reload

    查看防火墙:

    firewall-cmd --list-all

    4.修改Apache服务器的配置

     新建测试文件:

    vim /etc/httpd/conf.d/test.conf
    <Virtualhost *:80>
            ServerName server0.example.com
            DocumentRoot /var/www/html 
    </Virtualhost>

    其中:

      ServerName 为域名

      DocumentRoot 为html主页的路径

    5.创建一个html文件

    /var/www/html/index.html
    <html >
    <head>
        <title>页面导航</title>
        <style type="text/css">
            *{ margin:0; padding:0}
            //#id ul{  border: 2px solid red;}
            #id ul{ list-style-type:none; margin:0 auto;600px }
            #id ul li{  float:left; 100px; text-align:center }
            #id ul li a{ color:teal ; background-color:Aqua; display:inline-block;100px; line-height:30px ; text-decoration:none}
            #id ul li a:hover{  background-color:Blue; color:White; font-style:oblique; font-weight:bold; text-decoration:underline }
        </style>
    </head>
    <body>
    <div id="id">
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">探索百科</a></li>
            <li><a href="#">用户</a></li>
            <li><a href="#">任务</a></li>
            <li><a href="#">合作</a></li>
            <li><a href="#">知识商城</a></li>
        </ul>
    </div>
    </body>
    </html>

    6.启动http服务

    systemctl start httpd

    开机自启动:

    systemctl enable httpd

     7.在windows下访问该网页

    其中地址为服务器端的地址

    版权

    作者:feiquan

    出处:http://www.cnblogs.com/feiquan/

    版权声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

    大家写文都不容易,请尊重劳动成果~ 这里谢谢大家啦(*/ω\*)

  • 相关阅读:
    矩阵游戏|ZJOI2007|BZOJ1059|codevs1433|luoguP1129|二分图匹配|匈牙利算法|Elena
    BZOJ3262: 陌上花开
    BZOJ1176: [Balkan2007]Mokia
    BZOJ1261: [SCOI2006]zh_tree
    BZOJ2004: [Hnoi2010]Bus 公交线路
    BZOJ1066: [SCOI2007]蜥蜴
    BZOJ1294: [SCOI2009]围豆豆Bean
    BZOJ2756: [SCOI2012]奇怪的游戏
    BZOJ1857: [Scoi2010]传送带
    BZOJ1237: [SCOI2008]配对
  • 原文地址:https://www.cnblogs.com/feiquan/p/9236714.html
Copyright © 2011-2022 走看看