Reputation: 877
Hello all my document root location for my project is:
C:\xampp\htdocs\Warrington\public_html
I have updated my host file
C:\Windows\System32\drivers\etc\hosts
added the line
127.0.0.1 warrington.dev.com
I have then added to C:\xampp\apache\conf\extra\httpd-vhosts
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/xampp/htdocs/Warrington/public_html"
ServerName warrington.dev.com
ServerAlias www.warrington.dev.com
ErrorLog "C:/xampp/htdocs/Warrington/public_html/error_log"
</VirtualHost>
and then to C:\xampp\apache\conf\httpd
Alias /public_html "C:/xampp/htdocs/Warrington/public_html"
<Directory "C:/xampp/htdocs/Warrington/public_html">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
however when i restart apache and go to www.warrington.dev.com i get no error in the log apart from this Sorry, the website www.warrington.dev.com cannot be found.
any ideas what i am missing with setting up virtual host
I added to host file updates httpd and httpd-vhosts restarted apache and no joy
Upvotes: 0
Views: 276
Reputation: 102
Browsers now adays may have .dev extension disabled and may require a valid SSL through mydomain.test if you have WINDOWS (the following worked for me on CHROME DID NOT WORK FOR FIREFOX) you can try the following to create an SSL file for each domain. 1. Go to C:\xampp\apache\crt (create crt if you don't have this folder)
C:\xampp\apache\crt in the crt folder create the following 2 files:cert.conf and make-cert.bat (follow the links and copy the code)
In cert.conf edit where it says {{DOMAIN}} and replace it with your domain name example: mydomain.test and save the file (REMOVE THE curly brackets you don't need them).
Double click the make-cert.bat and input mydomain.test in the command prompt (same name you used in the cert.conf file) And you can just press enter and enter on the next prompts it really doesn't matter.
You will now see a site.test folder created. In that folder we will have server.crt and server.key. This is the SSL certificate.
Double click on the server.crt to install it on Windows so Windows can trust it. (Click Install Certificate) And select Local Machine as Store Location.
Select “Place all certificates in the following store” and click browse and select Trusted Root Certification Authorities.
Click Next and Finish. And now this cert is installed and trusted in Windows. Next is how to use this cert in XAMPP.
Open notepad as administrator. Edit C:\Windows\System32\drivers\etc\hosts (the file has no ext) Add this in a new line:
127.0.0.1 mydomain.test
We need to enable SSL for this domain and let XAMPP know where we store the SSL Cert. We need to edit C:\xampp\apache\conf\extra\httpd-xampp.conf And add this code at the bottom:
Last but not least you have to restart Apache server in the Xampp control panel(Switch it off and then back on again) Then Clear your browser's cache and then restart your browser. Enter mydomain.test in your browser it should direct your project's index file as specified in what we entered in C:\xampp\apache\conf\extra\httpd-xampp.conf
Upvotes: 0
Reputation: 4800
www.warrington.dev.com is not the same as warrington.dev.com, both need to have an IP address entry in your hosts file.
Upvotes: 1