Setting up a domain in Xampp

shape
shape
shape
shape
shape
shape
shape
shape

The Xampp installation uses localhost by default. In this tutorial we’ll learn how to set up a domain in Xampp.

Before starting this tutorial, make sure that you have opened TCP ports 80 and 443 in the Windows Firewall. We have a tutorial on how to do this ( Open ports in Windows Firewall ).

Assuming that Xampp is already installed and your domain already points to your server’s IP, we’ll edit the “httpd-vhosts.conf” file, located in the Xampp installation folder:

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

At the end of the httpd-vhosts.conf file, add the following configuration directives:


    ServerAdmin [email protected]
    DocumentRoot "C:\xampp\htdocs\vps2286-masterdaweb-net"
    ServerName vps2286.masterdaweb.net
    ErrorLog "logs/dummy-vps2286-masterdaweb-net-error.log"
    CustomLog "logs/dummy-vps2286-masterdaweb-net-access.log" common



    ServerAdmin [email protected]
    SSLEngine On
    SSLCertificateFile "C:/xampp/apache/conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "C:/xampp/apache/conf/ssl.key/server.key"
    DocumentRoot "C:\xampp\htdocs\vps2286-masterdaweb-net"
    ServerName vps2286.masterdaweb.net
    ErrorLog "logs/dummy-vps2286-masterdaweb-net-error.log"
    CustomLog "logs/dummy-vps2286-masterdaweb-net-access.log" common

Note that in our tutorial we are using the vps2286.masterdaweb.net domain as an example. You must replace it with the domain you want. The directives must be filled in according to the list below:

  • ServerAdmin (Webmaster email)
  • DocumentRoot (Folder where the site files are located)
  • ServerName (Site domain)
  • ErrorLog (Name of the error log file)
  • CustomLog (Name of the access log file)
  • SSLCertificateFile (SSL certificate file)
  • SSLCertificateKeyFile (SSL certificate file)

Note that if you don’t have an SSL contract for your domain, you should use the same file as in the example above in the SSLCertificateFile and SSLCertificateKeyFile directives.

Once configured, simply save the file and restart Apache by pressing “Stop” and then “Start”:

Xampp Control Panel

That’s it! Our example domain, vps2286.masterdaweb.net, will now be accessible via the Web:

Domain configured in Xampp

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest news

Latest news directly from our blog.