Last active
September 30, 2022 22:47
-
-
Save adojos/9507e8ab36b636e04a31f37a02c9766e to your computer and use it in GitHub Desktop.
Revisions
-
adojos revised this gist
Sep 30, 2022 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,13 +26,13 @@ In order to have a multi-port configuration for different virtual hosts (project Checkout the following gist links for complete changes to above configuration files each: [1. [Part 1 of 4] Apache Multi-Port & Multi-Host 'httpd.conf' Config](https://gist.github.com/adojos/e1c103ec974f2eeca3028d1daff1b377) [2. [Part 2 of 4] Apache Multi-Port & Multi-Host 'httpd-ssl.conf' Config](https://gist.github.com/adojos/f556f3a5e25a472297f1448f48d3f64a) [3. [Part 3 of 4] Apache Multi-Port & Multi-Host 'httpd-vhosts.conf'](https://gist.github.com/adojos/9507e8ab36b636e04a31f37a02c9766e) [4. [Part 4 of 4] Apache Multi-Port & Multi-Host Windows hosts file Config](https://gist.github.com/adojos/d95cb097f7c9d6feb5098adc7d26387c) </br> -
adojos revised this gist
Sep 30, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## [Part 3 of 4] Apache Multi-Port & Multi-Host 'httpd-vhosts.conf' </br> In order to have a multi-port configuration for different virtual hosts (projects, websites) on Apache in XAMPP, you need to make changes to the following 3 Apache configuration files and 1 windows host file: -
adojos revised this gist
Sep 30, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -342,7 +342,7 @@ NameVirtualHost *:8081 ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR wordpress-vanilla https ########################################################## <VirtualHost wordpress-vanilla:8088> -
adojos revised this gist
Sep 30, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -103,12 +103,12 @@ NameVirtualHost *:8081 ###################################################################### <VirtualHost *:8081> DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/" ServerName localhost </VirtualHost> <VirtualHost *:8082> DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/" ServerName localhost SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" -
adojos revised this gist
Sep 30, 2022 . 1 changed file with 8 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## Apache 'httpd-vhosts.conf' Config for Multi-Port & Multi-Host [Part 3 of 4] </br> In order to have a multi-port configuration for different virtual hosts (projects, websites) on Apache in XAMPP, you need to make changes to the following 3 Apache configuration files and 1 windows host file: @@ -26,9 +26,13 @@ In order to have a multi-port configuration for different virtual hosts (project Checkout the following gist links for complete changes to above configuration files each: [1. Config for 'httpd.conf' to Implement multiple ports and multiple-virtualHosts [Part 1 of 4]](https://gist.github.com/adojos/e1c103ec974f2eeca3028d1daff1b377) [2. Config for 'httpd-ssl.conf' to Implement multiple ports and multiple-virtualHosts [Part 2 of 4]](https://gist.github.com/adojos/f556f3a5e25a472297f1448f48d3f64a) [3. Config for 'httpd-vhosts.conf' to Implement multiple ports and multiple-virtualHosts [Part 3 of 4]](https://gist.github.com/adojos/9507e8ab36b636e04a31f37a02c9766e) [4. Config for 'windows 'hosts' file' to Implement multiple ports and multiple-virtualHosts [Part 4 of 4]](https://gist.github.com/adojos/d95cb097f7c9d6feb5098adc7d26387c) </br> -
adojos revised this gist
Sep 29, 2022 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,9 +37,8 @@ Checkout the following gist links for complete changes to above configuration fi Note the changes done for following directives in this file: ``` (a) HTTP VirtualHost *: 80 (b) HTTPS VirtualHost *: 443 ``` </br> -
adojos created this gist
Sep 29, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,363 @@ ## Configuring Apache for Multi-Port & Multi-Host via httpd-vhosts.conf </br> In order to have a multi-port configuration for different virtual hosts (projects, websites) on Apache in XAMPP, you need to make changes to the following 3 Apache configuration files and 1 windows host file: </br> </br> **1. httpd.conf** (\XAMPP\apache\conf\) **2. httpd-ssl.conf** (\XAMPP\apache\conf\extra\) **3. httpd-vhosts.conf** (\XAMPP\apache\conf\extra\) :point_down: _This file_ :point_down: **4. Windows 'hosts' file** (C:\Windows\System32\drivers\etc) </br> #### :point_right: Target Scenario: > ``` Making the above changes to your configuration files, you achieve the following target scenario - > 1) Implement 4 named and independent Virtual Hosts > 2) Implement 4 different HTTP ports for above Virtual Hosts (8081, 8083, 8085, 8087) > 3) Implement 4 different HTTPS ports for above Virtual Hosts (8082, 8084, 8086, 8088) > ``` </br> Checkout the following gist links for complete changes to above configuration files each: 1. XAMPP | Apache: Config for 'httpd.conf' to Implement multiple ports and multiple-virtualHosts [Part 1 of 4] 2. XAMPP | Apache: Config for 'httpd-ssl.conf' to Implement multiple ports and multiple-virtualHosts [Part 2 of 4] 3. XAMPP | Apache: Config for 'httpd-vhosts.conf' to Implement multiple ports and multiple-virtualHosts [Part 3 of 4] </br> ### httpd-vhosts.conf (\XAMPP\apache\conf\extra\) Note the changes done for following directives in this file: ``` (a) HTTPS Listen Port (b) HTTPS ServerName (c) VirtualHost Directive for httpd-ssl ``` </br> **:point_right: NOTE:** _Do not copy the whole file 'as-is', because it has been lifted from my production environment and may have hard-coded directory paths. I recommend only to refer the quoted key changes/modifications_ </br> ```shell # Virtual Hosts # # Required modules: mod_log_config # If you want to maintain multiple domains/hostnames on your # machine you can setup VirtualHost containers for them. Most configurations # use only name-based virtual hosts so the server doesn't need to worry about # IP addresses. This is indicated by the asterisks in the directives below. # # Please see the documentation at # <URL:http://httpd.apache.org/docs/2.4/vhosts/> # for further details before you try to setup virtual hosts. # # You may use the command line option '-S' to verify your virtual host # configuration. # # Use name-based virtual hosting. # ##NameVirtualHost *:80 NameVirtualHost *:8081 # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ##ServerName or ##ServerAlias in any <VirtualHost> block. # ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host.example.com ##DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/dummy-host.example.com" ##ServerName dummy-host.example.com ##ServerAlias www.dummy-host.example.com ##ErrorLog "logs/dummy-host.example.com-error.log" ##CustomLog "logs/dummy-host.example.com-access.log" common ##</VirtualHost> ##<VirtualHost *:80> ##ServerAdmin webmaster@dummy-host2.example.com ##DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/dummy-host2.example.com" ##ServerName dummy-host2.example.com ##ErrorLog "logs/dummy-host2.example.com-error.log" ##CustomLog "logs/dummy-host2.example.com-access.log" common ##</VirtualHost> ##################################################################### ## DEFAULT FALLBACK VIRTUAL HOST CONFIG FOR UNMATCHED HTTP/S REQUESTS ###################################################################### <VirtualHost *:8081> DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/hostnotfound" ServerName localhost </VirtualHost> <VirtualHost *:8082> DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/hostnotfound" ServerName localhost SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR PROJECT 1 - website1 http ########################################################## <VirtualHost website1:8081> ServerAdmin webmaster@website1.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/website1" ServerName website1 ServerAlias www.website1 ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/website1"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR PROJECT 1 - website1 https ########################################################## <VirtualHost website1:8082> ServerAdmin webmaster@website1.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/website1" ServerName website1 ServerAlias www.website1 SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/website1"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR PROJECT 2 - website2 http ########################################################## <VirtualHost website2:8081> ServerAdmin webmaster@website2.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/website2" ServerName website2 ServerAlias www.website2 ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/website2"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR PROJECT 2 - website2 https ########################################################## <VirtualHost website2:8082> ServerAdmin webmaster@website2.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/website2" ServerName website2 ServerAlias www.website2 SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/website1"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR automationdojos-demo http ########################################################## <VirtualHost automationdojos-demo:8081> ServerAdmin admin@automationdojos-demo.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-demo" ServerName automationdojos-demo ServerAlias www.automationdojos-demo ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-demo"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR automationdojos-demo https ########################################################## <VirtualHost automationdojos-demo:8082> ServerAdmin admin@automationdojos-demo.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-demo" ServerName automationdojos-demo ServerAlias www.automationdojos-demo SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-demo"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR automationdojos-dev http ########################################################## <VirtualHost automationdojos-dev:8083> ServerAdmin admin@automationdojos-dev.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-dev" ServerName automationdojos-dev ServerAlias www.automationdojos-dev ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-dev"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR automationdojos-dev https ########################################################## <VirtualHost automationdojos-dev:8084> ServerAdmin admin@automationdojos-dev.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-dev" ServerName automationdojos-dev ServerAlias www.automationdojos-dev SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-dev"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR automationdojos-prod http ########################################################## <VirtualHost automationdojos-prod:8085> ServerAdmin admin@automationdojos-prod.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-prod" ServerName automationdojos-prod ServerAlias www.automationdojos-prod ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-prod"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR automationdojos-prod https ########################################################## <VirtualHost automationdojos-prod:8086> ServerAdmin admin@automationdojos-prod.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-prod" ServerName automationdojos-prod ServerAlias www.automationdojos-prod SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/automationdojos-prod"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTP CONFIG FOR wordpress-vanilla http ########################################################## <VirtualHost wordpress-vanilla:8087> ServerAdmin admin@wordpress-vanilla.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/wordpress-vanilla" ServerName wordpress-vanilla ServerAlias www.wordpress-vanilla ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/wordpress-vanilla"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ########################################################## ## VIRTUAL HOST HTTPS CONFIG FOR automationdojos-prod https ########################################################## <VirtualHost wordpress-vanilla:8088> ServerAdmin admin@wordpress-vanilla.com DocumentRoot "D:/DEV-WORKSPACE/XAMPP/htdocs/wordpress-vanilla" ServerName wordpress-vanilla ServerAlias www.wordpress-vanilla SSLEngine On SSLCertificateFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.crt/server.crt" SSLCertificateKeyFile "D:/DEV-WORKSPACE/XAMPP/apache/conf/ssl.key/server.key" ErrorLog "logs/website1-error.log" CustomLog "logs/website1-access.log" common <Directory "D:/DEV-WORKSPACE/XAMPP/htdocs/wordpress-vanilla"> AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ```