zoukankan      html  css  js  c++  java
  • php中搭建Web服务器和服务器配置

    1.搭建Web服务器

        1.1目录结构

     

         1.2访问服务器

    访问规则:http://服务器ip地址/php页面
    比如:
    http://localhost/demo.php
    http://127.0.0.1/demo.php

         1.3Apache常用命令

    httpd -v   查看apache版本号   version
    httpd -t   检测运行环境  test

         1.4互联网通讯原理

          访问过程:

     

          步骤:

          1、客户端输入域名(网址),在最近的机房做DNS解析(Domain Name Server),DNS解析就是将域名转化成IP地址

          2、通过IP地址访问服务器

         1.5DNS解析

         目标:ip地址访问服务器不方便,通过域名来访问。

         hosts文件用来做DNS解析

         2.服务器配置

         2.1虚拟目录配置

     

    <VirtualHost _default_:80>
    #设置根目录
    DocumentRoot "G:phpStudyPHPTutorialphpMyAdmin"
    #设置域名
     ServerName www.phpmyadmin.com
     #目录权限
      <Directory "G:phpStudyPHPTutorialphpMyAdmin">
       #允许将目录结构用索引的方式展示
        Options +Indexes +FollowSymLinks +ExecCGI
        #允许覆盖;,用来做分布式部署
        AllowOverride All
        #执行顺序,先允许,后拒绝
        Order allow,deny
        #允许所有请求
        Allow from all
        Require all granted 
      </Directory>
      </VirtualHost>

           更改默认首页      

    <IfModule dir_module>
        DirectoryIndex index.html index.php index.htm l.php
    </IfModule>

            更改监听端口

    Listen 80

            2.2虚拟主机配置

    <VirtualHost _default_:80>
      DocumentRoot "C:web1"       #指定虚拟目录路径
      ServerName www.baidu.com     # 虚拟目录绑定的域名
      DirectoryIndex aa.php        # 默认首页
      <Directory "C:web1">
        Options -Indexes -FollowSymLinks +ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
        Require all granted
      </Directory>
    </VirtualHost>
  • 相关阅读:
    背水一战 Windows 10 (26)
    背水一战 Windows 10 (25)
    背水一战 Windows 10 (24)
    背水一战 Windows 10 (23)
    背水一战 Windows 10 (22)
    背水一战 Windows 10 (21)
    背水一战 Windows 10 (20)
    背水一战 Windows 10 (19)
    背水一战 Windows 10 (18)
    背水一战 Windows 10 (17)
  • 原文地址:https://www.cnblogs.com/shineguang/p/10957754.html
Copyright © 2011-2022 走看看