简体   繁体   English

虚拟主机的配置

[英]Configuration of virtual host

I was trying to create a virtual host on my localhost, I followed a tuto on the internet. 我试图在本地主机上创建虚拟主机,然后在互联网上浏览了一个tuto。 Here're the steps : 步骤如下:

1) I created my project on desktop (using laravel 5) 1)我在桌面上创建了我的项目(使用laravel 5)

2) I opend the file "httpd-vhosts.conf" (C:\\Program Files (x86)\\EasyPHP-Devserver-16.1\\eds-binaries\\httpserver\\apache2418x161221110224\\conf\\httpd-vhosts.conf ) to uncomment this line : "Include conf/extra/httpd-vhosts.conf" 2)我打开文件“ httpd-vhosts.conf”(C:\\ Program Files(x86)\\ EasyPHP-Devserver-16.1 \\ eds-binaries \\ httpserver \\ apache2418x161221110224 \\ conf \\ httpd-vhosts.conf)以取消注释此行: “包括conf / extra / httpd-vhosts.conf”

3) I edited the file "httpd-vhosts.conf" I added the following lines : 3)我编辑了文件“ httpd-vhosts.conf”,并添加了以下几行:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:\Users\Sony\Desktop\links"
ServerName links.localhost
</VirtualHost>

4) I edited the file "hosts" (C:\\Windows\\System32\\drivers\\etc\\hosts) and added this line "127.0.0.1 links.localhost" 4)我编辑了文件“主机”(C:\\ Windows \\ System32 \\ drivers \\ etc \\ hosts),并添加了这行“ 127.0.0.1 links.localhost”

5) Then I restarted easyphp and executed the following command on my command line : ipconfig /flushdns 5)然后重新启动easyphp并在命令行上执行以下命令:ipconfig / flushdns

--> Results : The file "httpd-vhosts.conf" is empty ->结果:文件“ httpd-vhosts.conf”为空

This line is commented again : "Include conf/extra/httpd-vhosts.conf" 此行再次被注释:“ Include conf / extra / httpd-vhosts.conf”

When I try to access the vhost " http://links.localhost ", is just like if i am accessing the localhost 当我尝试访问虚拟主机“ http://links.localhost ”时,就像我访问本地主机一样

This is what I have at the end of "httpd.conf" 这就是我在“ httpd.conf”结尾处的内容

# VIRTUAL HOSTS
## Virtualhost localweb
<VirtualHost 127.0.0.1>
DocumentRoot "C:/Program Files (x86)/EasyPHP-Devserver-16.1/eds-www"
ServerName 127.0.0.1
<Directory "C:/Program Files (x86)/EasyPHP-Devserver-16.1/eds-www">
    Options FollowSymLinks Indexes
    AllowOverride All
    Order deny,allow
    Allow from 127.0.0.1
    Deny from all
    Require all granted
</Directory>
</VirtualHost>
#Costumized vhost config file
Include conf/links-vhost.conf

First create a file (say) name it links.conf and add your Virtual host 首先创建一个文件(例如),将其命名为links.conf然后添加您的虚拟主机

<VirtualHost *:80>
DocumentRoot "C:\Users\Sony\Desktop\links"
ServerName links.localhost
</VirtualHost>

Now at the the end of your httpd.conf add : Include conf/links.conf . 现在,在httpd.conf的末尾添加: Include conf/links.conf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM