I am configure virtualhost on Xampp so that I can run an advanced Yii2 project (with front and backend application), I have followed this instruction and my httpd-vhosts.conf
looks like this
<VirtualHost *:8081>
ServerName winnersprimary.ac.tz
DocumentRoot 'c:xampphtdocswinnersprimaryfrontendweb'
<Directory 'c:xampphtdocswinnersprimaryfrontendweb'>
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8081>
ServerName admin.winnersprimary.ac.tz
DocumentRoot 'c:xampphtdocswinnersprimarybackendweb'
<Directory 'c:xampphtdocswinnersprimarybackendweb'>
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
# Apache 2.4
Require all granted
## Apache 2.2
# Order allow,deny
# Allow from all
</Directory>
</VirtualHost>
while apache main port is 8081 and SSL port 4433 but it gives the error as shown on the picture bellow and the error.log
says [Sat Jun 19 11:01:06.453372 2021] [ssl:warn] [pid 11044:tid 172] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
how should I solve this error? I have tried several times to change the port numbers with no success.
2
Answers
I finally solved it and I would like to share my solution here as it might help someone out there, I run
apache_start.bat
on xammp shell and found that was writingDocumentRoot
in this wayDocumentRoot "c:xampphtdocswinnersprimaryfrontendweb"
instead of this wayDocumentRoot "c:/xampp/htdocs/winnersprimary/frontend/web/"
note the difference on the slashes :) Click here for referenceOn XAMPP Control Panel click on Explorer which is below Shell
(This will open xampp file explorer)
Select and open apache folder and go to conf/extra folder
Inside the xampp/apache/conf/extra folder, the file you’re looking for is called httpd-ssl.conf
This file deals with the SSL configuration for your XAMPP Apache installation.
Open httpd-ssl file in any editor and search for ServerName http://www.example.com:443
Comment out this line by just adding # infront of it.
Next, you can add the text “ServerName winnersprimary.ac.tz” on the line directly below it.
Save and close file
Restart Apache or Xampp Control panel