How to enable Virtual Host on Xampp for Laravel?

后端 未结 3 465
别跟我提以往
别跟我提以往 2020-12-14 22:33

I have XAMPP running on Windows 7 Pro. I am trying to setup a Virtual Host so that when I use \"dev.app\" as a domain I get directly to my public folder of laravel installat

3条回答
  •  没有蜡笔的小新
    2020-12-14 23:20

    The hosts file should look like this so that it can be found on the IPV4 and IPV6 networks

    127.0.0.1  localhost dev.app
    ::1        localhost dev.app
    

    If you are using Apache 2.4.x this line in httpd-vhosts.conf

    NameVirtualHost *:80
    

    is no longer required or allowed for Apache 2.4.

    The vhost file should look like this, you mixed Apache 2.2 and 2.4 syntax and while either is allowed as long as you have mod_access_compat activated, you should not mix them and the 2.4 syntax is better. You also missed a few other useful bits and pieces

    
        DocumentRoot "F:/xampp/htdocs/"
        ServerAdmin admin@localhost
        ServerName localhost
    
        
           Options Indexes FollowSymLinks
           AllowOverride all
           Require local
        
    
    
    
        DocumentRoot "F:/xampp/htdocs/dev/public"
        ServerAdmin admin@localhost
        ServerName dev.app
        ServerAlias www.dev.app
    
        
           AllowOverride All
           Options Indexes FollowSymLinks
    
           Require local
           # if you want access from other pc's on your local network
           #Require ip 192.168.1
           # Only if you want the world to see your site
           #Require all granted
        
    
    

提交回复
热议问题