This guide walks you through deploying two static websites using Apache on Windows.
- Windows 10 or later
- Administrative privileges
- XAMPP installer from apachefriends.org
- Download XAMPP installer
- Run the installer as Administrator
- Select components (minimum required):
- Apache
- MySQL
- PHP
- Choose installation directory (default:
C:\xampp) - Complete the installation
- Open
C:\xampp\apache\conf\httpd.conf - Ensure these lines are uncommented:
LoadModule rewrite_module modules/mod_rewrite.so LoadModule vhost_alias_module modules/mod_vhost_alias.so
- Open
C:\xampp\apache\conf\extra\httpd-vhosts.conf - Add your virtual host configurations:
<VirtualHost *:80> ServerName site-a.local DocumentRoot "C:/xampp/htdocs/site-a" <Directory "C:/xampp/htdocs/site-a"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerName site-b.local DocumentRoot "C:/xampp/htdocs/site-b" <Directory "C:/xampp/htdocs/site-b"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
- Open Notepad as Administrator
- Open
C:\Windows\System32\drivers\etc\hosts - Add these lines:
127.0.0.1 site-a.local 127.0.0.1 site-b.local
# Create directories
mkdir C:\xampp\htdocs\site-a
mkdir C:\xampp\htdocs\site-b
# Create index files
echo "<h1>Welcome to Site A</h1>" > C:\xampp\htdocs\site-a\index.html
echo "<h1>Welcome to Site B</h1>" > C:\xampp\htdocs\site-b\index.html- Open XAMPP Control Panel
- Click "Start" next to Apache
- Verify service shows green status
- Open browser and visit:
- You should see the respective website content
- Open Command Prompt as Administrator
- Run:
netstat -ano | findstr :80 - Note the PID using port 80
- Run:
taskkill /PID <PID> /F
- Right-click on htdocs folder
- Properties → Security → Edit
- Add your user with Full control
- Apply changes
- Check XAMPP error logs:
C:\xampp\apache\logs\error.log - Verify no other web servers are running
- Try changing Apache port in
httpd.conf