xampp configure virtual host

1. Configure the local routing table (C:\Windows\System32\drivers\etc\hosts)

add at the end of the file   

127.0.0.1 localhost

127.0.0.1 www.tp5.com    

2. apache opens the virtual host (D:\xampp\apache\conf\httpd.conf)

# Virtual hosts
Include conf/extra/httpd-vhosts.conf//确保此段开头没有#,也就是确保引入了 vhosts 虚拟主机配置文件。


<Directory "D:/xampp/cgi-bin">
    AllowOverride All
    Options None
    Require all granted
</Directory>
//修改为
<Directory "D:/xampp/cgi-bin">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>


DocumentRoot "D:/xampp/htdocs"//确保此处路径是你要访问的项目的根路径

3. Modify the virtual host configuration (D:\xampp\apache\conf\extra\httpd-vhosts.conf)

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/"
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "D:/xampp/htdocs/tp5/public"
    ServerName www.tp5.com
</VirtualHost>


4. Restart apache

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325864674&siteId=291194637