Add Virtual Host for Localhost Ampps

前端 未结 3 1563
时光取名叫无心
时光取名叫无心 2021-01-27 12:49
  
    DocumentRoot \"C:/Program Files (x86)/Ampps/www\"
    ServerName localhost


  
    DocumentRo         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-27 13:09

    As you said you are using AMPPS, I suppose you are adding this instructions to the folder:

    AMPPS/apache/conf/extra/httpd-vhosts.conf
    

    With that in mind I'll show an example of configuration.

    
        
            Options FollowSymLinks Indexes
            AllowOverride All
            Order deny,allow
            allow from All
        
        ServerName project.local
        ServerAlias project.local 127.0.0.1
        ScriptAlias /cgi-bin/ "/Users/you/yourproject/cgi-bin/"
        DocumentRoot "/Users/you/yourproject"
        ErrorLog "/Applications/AMPPS/apache/logs/project.error_log"
        CustomLog "/Applications/AMPPS/apache/logs/project.access.log" combined
    
    

    All right. After doing that, you will have to add to your hosts file. In Mac they are located in:

    /etc/hosts
    

    If you are using a Windows environment you will find the hosts file in:

    c:\windows\system32\drivers\etc\hosts
    

    Attention: You may have to type your password again or allow the program you're using to edit the file to use administrator privileges.

    Then you'll add your local IP and the hostname to it. Just like this:

    127.0.0.1      project.local
    

    If you don't add the URL to the hosts file that won't work.

提交回复
热议问题