Virtual hosts and self-signed SSL certificates management system (in console mode) for Xampp on Windows OS.
Documentation languages >>> ( English | Vietnamese )
Someone once asked me
How to configure and manage Virtual Hosts for Xampp on Windows OS?
A few others asked
How do I add self-signed SSL certificates to Xampp Virtual Hosts as quickly as possible and easily manage them without the hassle of using OPENSSL commands?
Therefore, this project was born, in order to strengthen Xampp, helping users take advantage of Xampp's inherent resources to make the above purposes as quickly and easily as possible.
Note: Currently this project only supports Windows users.
- Create virtual host.
- Remove an existing virtual host.
- Display information of an existing virtual host.
- List all existing virtual hosts.
- Add SSL certificate to an existing virtual host.
- Remove SSL certificate of an existing virtual host.
- Change Document Root of an existing virtual host.
- Stop Xampp Apache Httpd.
- Start Xampp Apache Httpd.
- Restart Xampp Apache Httpd.
Look at one of the following topics to learn more about Xampp vHosts Manager.
- Xampp vHosts Manager
- Features of this project
- Overview
- Compatibility
- Requirement
- Installation
- Updation
- Usage
- Display the help message
- Create new virtual host
- Display information of an existing virtual host
- List all existing virtual hosts
- Remove an existing virtual host
- Add SSL certificate to an existing virtual host
- Remove SSL certificate of an existing virtual host
- Change Document Root of an existing virtual host
- Stop Apache Httpd
- Start Apache Httpd
- Restart Apache Httpd
- Register path of application
- Grant necessary permissions to Windows hosts file
- Configuration
- License
- Thanks for use
- Xampp vHosts Manager is compatible with all Xampp versions using PHP 5.4 or higher.
- Currently, this project does not yet support the portable Xampp version.
Xampp vHosts Manager takes full advantage of what's included in Xampp, nothing more needed. So, you just need following things:
- Installed Xampp (of course).
- Added the path to PHP directory of Xampp into Windows Path Environment Variable.
- (Optional) Installed Composer.
Note: See here to know how to add Windows Path Environment Variable.
There are two installation methods, via Composer or manual download. It is recommended to use the method via Composer if you already have it installed.
- Open a terminal.
- Navigate to the directory you want to install Xampp vHosts Manager into.
- Run composer create-project command:
$ composer create-project jackiedo/xampp-vhosts-manager xvhm "1.*"
- Download the latest release version
- Extract the archive to a shared location
(example: D:\xvhm)
. Note: Should not place inC:\Program Files
or anywhere else that would require Administrator access for modifying configuration files. - Open a terminal in Administrator mode
(run as Administrator)
. - Navigate to the directory you have placed Xampp vHosts Manager
(example: cd /D D:\xvhm)
. - Execute the command
xvhost install
and follow the required steps. - Exit terminal (to remove temporary environment variables).
Note: See here to know how to to open the command prompt as Administrator.
Currently, Xampp vHosts Manager does not have an automatic update mechanism, we have to do it manually step by step as follows:
- Backup the
settings.ini
file and thecacert
folder in your Xampp vHosts Manager's directory to somewhere else. - Remove all files and sub-folders in Xampp vHosts Manager application directory.
- Download the latest release version and extract it into Xampp vHosts Manager application directory.
- Copy the previously backed up
settings.ini
file andcacert
folder into the Xampp vHosts Manager application directory back.
Because of a path to the Xampp vHosts Manager application directory has been added to the Windows Path Environment Variables during the installation process, now you can just open the terminal (no need to open in Administrator mode anymore)
anywhere and excute one of the following xvhost
commands:
Syntax:
$ xvhost help
Syntax:
$ xvhost new [HOST_NAME]
Example:
$ xvhost new demo.local
Note: The HOST_NAME parameter is optional. If you do not pass it to the command statement, you will also be asked to enter this information later.
Syntax:
$ xvhost show [HOST_NAME]
Example:
$ xvhost show demo.local
Syntax:
$ xvhost list
Syntax:
$ xvhost remove [HOST_NAME]
Example:
$ xvhost remove demo.local
Syntax:
$ xvhost add_ssl [HOST_NAME]
Example:
$ xvhost add_ssl demo.local
Syntax:
$ xvhost remove_ssl [HOST_NAME]
Example:
$ xvhost remove_ssl demo.local
Syntax:
$ xvhost change_docroot [HOST_NAME]
Example:
$ xvhost change_docroot demo.local
Syntax:
$ xvhost stop_apache
Syntax:
$ xvhost start_apache
Syntax:
$ xvhost restart_apache
This feature allows you to register the path to the application directory of Xampp vHosts Manager into the Windows Path Environment Variable. Usually, you rarely need this. It is only useful when you need to change the application directory name of Xampp vHosts Manager or move it to another location.
To do this, after you have changed the directory, navigate to the new location of application directory in the command prompt and run the following command:
Syntax:
$ xvhost register_path
Note: You need to accept this process to be performed with Administrator permission.
This feature will grant Modify
, Read & execute
, Read
, Write
permissions to the Windows hosts
file for the Users
account. This makes it possible for Xampp vHosts Manager to add the host name to the Windows hosts
file every time you create a virtual host.
Syntax:
$ xvhost grantperms_winhosts
Note: You need to accept this process to be performed with Administrator permission.
All onfiguration are put in an ini file with name settings.ini
located in Xampp vHosts Manager application directory. The structure of this file looks like this:
[Section_1]
setting_1 = "value"
setting_2 = "value"
[Section_2]
setting_1 = "value"
setting_2 = "value"
...
The whole configuration of XVHM includes:
[DirectoryPaths]
;The path to your Xampp directory.
Xampp = "D:\xampp"
[Suggestions]
;The path to directory used to propose as DocumentRoot config in vhost config file each vhost creation process.
;The variable {{host_name}} is used as virtual host name placeholder.
DocumentRoot = "D:\www\{{host_name}}"
;The email used to propose as ServerAdmin config in vhost config file each vhost creation process.
AdminEmail = "anhvudo@gmail.com"
[ListViewMode]
;The number of records will be displayed on each page when listing the existing virtual hosts.
RecordPerPage = "3"
MIT © Jackie Do
Hopefully, this package is useful to you.