Naj
Naj

Reputation: 119

Configuration of virtual host

I was trying to create a virtual host on my localhost, I followed a tuto on the internet. Here're the steps :

1) I created my project on desktop (using 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"

3) I edited the file "httpd-vhosts.conf" I added the following lines :

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"

5) Then I restarted easyphp and executed the following command on my command line : ipconfig /flushdns

--> Results : The file "httpd-vhosts.conf" is empty

This line is commented again : "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

This is what I have at the end of "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

Upvotes: 0

Views: 1968

Answers (1)

Luzan Baral
Luzan Baral

Reputation: 3698

First create a file (say) name it links.conf and add your Virtual host

<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.

Upvotes: 1

Related Questions