如何在 laragon 中设置自定义虚拟主机名
How to set custom virtual host name in laragon
我有一个名为 'my-new-project' 的项目(这只是一个示例)。使用 laragon 自动虚拟主机名功能,我可以通过 http://my-new-project.test/
浏览这个项目
是否可以使用其他名称而不是此项目名称来浏览此项目,例如... http://project.test/?
此外,C:\laragon\etc\apache2\sites-enabled 中.conf 文件中的ServerName 和ServerAlias 是什么?
我找到了在不同搜索下可能有用的说明部分:
enter link description here
来自于:
...At this point, I’ve made a {name}.local, so let’s say, the URL in
my wordpress\ directory is http://wordpress.local. You can either set
something as you like, or, leave the default one. When launching Auto
Virtual Hosts, press Yes to allow any permissions in Windows. These
Auto Virtual Hosts automatically edit your hosts file. You no longer
need to write the hosts file.
最简单的办法就是耍花招!
在 my-new-project
文件夹旁边创建另一个名为 project
的文件夹。
然后转到 C:\laragon\etc\apache2\sites-enabled
路径并编辑 auto.project.test.conf
。
编辑这些:
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/project"
ServerName project.test
ServerAlias *.project.test
<Directory "C:/laragon/www/project">
AllowOverride All
Require all granted
</Directory>
这些:
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/my-new-project"
ServerName project.test
ServerAlias *.project.test
<Directory "C:/laragon/www/my-new-project">
AllowOverride All
Require all granted
</Directory>
这是简单的方法。
对于这个问题:
Also, what is ServerName and ServerAlias located in .conf file inside C:\laragon\etc\apache2\sites-enabled?
转到此 link:
What is the difference between ServerName and ServerAlias in apache2 configuration?
我有一个名为 'my-new-project' 的项目(这只是一个示例)。使用 laragon 自动虚拟主机名功能,我可以通过 http://my-new-project.test/
浏览这个项目是否可以使用其他名称而不是此项目名称来浏览此项目,例如... http://project.test/?
此外,C:\laragon\etc\apache2\sites-enabled 中.conf 文件中的ServerName 和ServerAlias 是什么?
我找到了在不同搜索下可能有用的说明部分: enter link description here
来自于:
...At this point, I’ve made a {name}.local, so let’s say, the URL in my wordpress\ directory is http://wordpress.local. You can either set something as you like, or, leave the default one. When launching Auto Virtual Hosts, press Yes to allow any permissions in Windows. These Auto Virtual Hosts automatically edit your hosts file. You no longer need to write the hosts file.
最简单的办法就是耍花招!
在 my-new-project
文件夹旁边创建另一个名为 project
的文件夹。
然后转到 C:\laragon\etc\apache2\sites-enabled
路径并编辑 auto.project.test.conf
。
编辑这些:
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/project"
ServerName project.test
ServerAlias *.project.test
<Directory "C:/laragon/www/project">
AllowOverride All
Require all granted
</Directory>
这些:
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/my-new-project"
ServerName project.test
ServerAlias *.project.test
<Directory "C:/laragon/www/my-new-project">
AllowOverride All
Require all granted
</Directory>
这是简单的方法。
对于这个问题:
Also, what is ServerName and ServerAlias located in .conf file inside C:\laragon\etc\apache2\sites-enabled?
转到此 link: What is the difference between ServerName and ServerAlias in apache2 configuration?