Configuring Virtual Hosts on Xampp – How to Run Multiple Domains

1. add : httpd-vhosts.conf
C:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot C:/xampp/htdocs
    ServerName localhost

    <Directory "C:/xampp/htdocs">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /www/v24.org
    ServerName v24.org
    ServerAlias www.v24.org *v24.org
    ErrorLog "logs/v24.org-error.log"
    CustomLog "logs/v24.org-access.log" common

    <Directory "/www/v24.org">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /www/nakhonitech.com
    ServerName nakhonitech.com
    ServerAlias www.nakhonitech.com *.nakhonitech.com
    ErrorLog "logs/nakhonitech.com-error.log"
    CustomLog "logs/nakhonitech.com-access.log" common

    <Directory "/www/nakhonitech.com">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


2. add : hosts
C:\windows\system32\drivers\etc\hosts


# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost
127.0.0.1 v24.org
127.0.0.1 nakhonitech.com

 

3.error  403
C:\xampp\apache\conf\extra\httpd-xampp.conf

    <Directory "/www/v24.org">
    AllowOverride AuthConfig Limit
    Order allow,deny
    Require all granted
    Allow from all
    </Directory>
    
    <Directory "/www/nakhonitech.com">
    AllowOverride AuthConfig Limit
    Order allow,deny
    Require all granted
    Allow from all
    </Directory>

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

วิธีทำ Virtual Host บน XAMPP ในระบบปฏิบัติการ Windows

Virtual Host คืออะไร ? Virtual Host คือ การทำให้ Server...

New xampp security concept: Access Forbidden Error 403 - Windows - phpMyAdmin

ขั้นตอน config XAMPP ให้สามารถเข้าถึงจากเครื่องอื่นได้Access forbidden! New XAMPP security...

Changing the maximum upload size in php.ini

Error text: file_name" has failed to upload due to an error - This file exceeds the maximum...

วิธีติดตั้ง SSL Certificate บน XAMPP Web Server

ขั้นตอนการติดตั้ง SSL Certificate เตรียมไฟล์ดังต่อไปนี้ให้พร้อม 1.certificate file - server.crt...