I added a virtual host in httpd-vhosts.conf as follows
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs/basicwebsite/public"
ServerName basicwebsite.dev
</VirtualHost>
and I also uncommented Include conf/extra/httpd-vhosts.conf
from https.conf as suggested in similar threads.
I also added 127.0.0.1 basicwebsite.dev
in windows/system32/drivers/etc/hosts
.
Now when I start Apache it gives the following error
12:07:33 PM [Apache] Error: Apache shutdown unexpectedly.
12:07:33 PM [Apache] This may be due to a blocked port, missing dependencies,
12:07:33 PM [Apache] improper privileges, a crash, or a shutdown by another method.
12:07:33 PM [Apache] Press the Logs button to view error logs and check
12:07:33 PM [Apache] the Windows Event Viewer for more clues
12:07:33 PM [Apache] If you need more help, copy and post this
12:07:33 PM [Apache] entire log window on the forums
When I remove the VirtualHost from httpd-vhosts.conf
, Apache starts working smoothly again..
What I am doing wrong?
Any suggestions/help would be appreciated.
2
Answers
Step 1:
Open httpd.conf file present in C:xamppapacheconfhttpd.conf
Remove the #(hash) sign present to include the “httpd-vhosts.conf” file in httpd.conf file.
Virtual hosts
#Include conf/extra/httpd-vhosts.conf
To
Virtual hosts
Include conf/extra/httpd-vhosts.conf
Step 2:
Create a virtualhost file. Open “httpd-vhosts.conf” file. And copy the below lines of code.
Replace PATH_TO_PROJECT_DIRECTORY_HERE & SERVER_NAME with appropriate values, Save the file.
Step3:
Open C:WindowsSystem32driversetchosts
Add the below line at the end of file.
Restart apache server and visit the site URL.
That’s all is needed to set up a virtual host.
Try adding the Directory tag in your VirtualHost