How to set the DOCUMENT_ROOT and site root in my local PHP dev setup?

前端 未结 5 1690
孤街浪徒
孤街浪徒 2021-01-30 11:56

I\'m doing a job for a guy with a site online. It\'s an alien site to me, and I\'m slowly working through the strange code. I have MAMP locally and my http://localhost/ has many

5条回答
  •  误落风尘
    2021-01-30 12:40

    What I would recommend is vhosts so you can serve up "alien site" locally without messing with your default web server.

    • localhost -> your start page or whatever
    • alien.localhost -> clients site, whatever path / doc root you want.
    • x.localhost -> another site

    In apaches global config file or included vhost.conf;

    NameVirtualHost localhost:80
    # the mysql tool's url
    
    # and absolute path
    DocumentRoot "/srv/www/phpMyAdmin/"
    
    
    #Same for the Client Site
    
    DocumentRoot "/path/to/desired/webroot/"
    
    

    You can control permissons and set a overall global site by specifying the below first

    in apache's global server config

    DocumentRoot "/srv/www/htdocs"
    #
    # Configure the DocumentRoot Properties
    #
     
        Options All
        # AllowOverride controls what directives may be placed in .htaccess files.
        # It can be "All", "None", or any combination of the keywords:
        #   Options FileInfo AuthConfig Limit
        AllowOverride All
        # Controls who can get stuff from this server.
        Order allow,deny
        Allow from all
    
    #
    # Configure Sub-Domain Properties. This prevents those nasty 403 errors
    #
     
    # mysql administration tool
    
        Options Indexes MultiViews
        AllowOverride All
        Order allow,deny
        Allow from all
    
     
    # a client web site built with CakePHP
    
        Options All
        AllowOverride All
        Order allow,deny
        Allow from all
    
    

提交回复
热议问题