zoukankan      html  css  js  c++  java
  • Mac下配置apache

    一、前言

        今天遇到问题,怎么配置apache在Mac上,原来Mac自带apache,只需要自己开启配置一下就行了。

    二、步骤:

        1、修改apache的http_conf文件

            打开finder前往/private/etc/apache2,在这个文件加下有一个http.conf用文本编辑器打开。

            修改第一处:查找php。得到如下结果

            

        #LoadModule php5_module libexec/apache2/libphp5.so
    

      

                去掉前面的#号。

            修改第二处:查找documentRoot。会找到类似的语句

    #
    
    # DocumentRoot: The directory out of which you will serve your
    
    # documents. By default, all requests are taken from this directory, but
    
    # symbolic links and aliases may be used to point to other locations.
    
    #
    
    DocumentRoot "/Users/admin/Sites"
    
    <Directory "/Users/admin/Sites">
    
        #
    
        # Possible values for the Options directive are "None", "All",
    
        # or any combination of:
    
        #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    
        #
    
        # Note that "MultiViews" must be named *explicitly* --- "Options All"
    
        # doesn't give it to you.
    
        #
    
        # The Options directive is both complicated and important.  Please see
    
        # http://httpd.apache.org/docs/2.4/mod/core.html#options
    
        # for more information.
    
        #
    
        Options FollowSymLinks Multiviews
    
        MultiviewsMatch Any
    

      

     

    在DocumentRoot “”引号中填入自己的路径。我的是在Users/admin/Sites,同时把紧挨着的Directory的“”引号后面也修改为自己的路径。

            修改第三处:查找:directory.会找到类似的语句

    #
    
    # "/Library/WebServer/CGI-Executables" should be changed to whatever your ScriptAliased
    
    # CGI directory exists, if you have that configured.
    
    #
    
    <Directory "/Library/WebServer/CGI-Executables">
    
        AllowOverride None
    
        Options None
    
        Require all granted
    
    </Directory>
    
     
    
    <IfModule mime_module>
    
        #
    
        # TypesConfig points to the file containing the list of mappings from
    
        # filename extension 
    

      

     

    将<Directory></Directory>中的内容修改为我上面的。

        然后保存。

        第二步:重启apache

            下边是用到的命令

          

      停止服务:sudo /usr/sbin/apachectl stop
    
                  开启服务:sudo /usr/sbin/apachectl start
    
                  重启服务:sudo /usr/sbin/apachectl restart
    

      

     

    然后在你刚在指定的文件夹下新建一个php文件测试即可。(我的在/Users/admin/Sites

    亲,成功了么?成功了请回复一下。不成功再修改,个人亲测可以。

  • 相关阅读:
    Angular Universal 学习笔记
    SAP Spartacus 如何获得当前渲染页面的 CMS 元数据
    Angular 服务器端渲染的学习笔记(二)
    Angular 服务器端渲染的学习笔记(一)
    第三方外部 Saas提供商如何跟使用 SAP 系统的客户进行对接接口集成
    如何从 SAP Spartacus Product Detail 页面,找到其 Angular 实现 Component 的位置
    具备自动刷新功能的 SAP ABAP ALV 报表
    C++学习目录
    c--条件编译
    c--文件读写--二进制
  • 原文地址:https://www.cnblogs.com/zhanggui/p/4458134.html
Copyright © 2011-2022 走看看