I'm facing below issue while use XAMPP in windows. Same working if I connect with VPN.
Unknown Host
Description: Unable to locate the server named "d8.kali" --- the server does not have a DNS entry. Perhaps there is a misspelling in the server name, or the server no longer exists. Double-check the name and try again.
C:\Windows\System32\drivers\etc: hosts
127.0.0.1 localhost
127.0.0.1 d8.kali
C:\xampp\apache\conf\extra: httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/drupal-8"
ServerName d8.kali
ErrorLog "logs/d8.kali-error.log"
CustomLog "logs/d8.kali-access.log" common
</VirtualHost>
Edit:
I have this setup in my local system.
As per below comment, used IP. Even not working.
127.0.0.1 localhost
#.#.#.#(IP) d8.kali
Related
I am following a laravel tutorial, where tutor sets up a virtual host to run their app. The app is located in /opt/lampp/htdocs/first-app. My port for running apache is 8000. So if I visit localhost:8000/first-app/public, I can view my laravel app.
My httpd-vhosts.conf file looks like this:
<VirtualHost *:8000>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "/opt/lampp/htdocs"
ServerName localhost
ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:8000>
DocumentRoot "/opt/lampp/htdocs/first-app/public"
ServerName app.test
ServerAlias www.app.test
<Directory "/opt/lampp/htdocs/first-app">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
My /etc/hosts file looks like this:
127.0.0.1 localhost app.test
::1 localhost app.test
127.0.1.1 pop-os.localdomain pop-os
127.0.0.1 app.test
I have uncommented httpd.conf like so
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
But I am getting this when I visit app.test
Browser output when app.test is visited
What am I doing wrong?
Edit: I have discovered, if I visit www.app.test:8000, it works fine
Just found out that the browser automatically adds port 80. So since I am running apache on port 8000, I need to specify it.
Thus, the settings above actually worked. All I had to do was go to http://localhost:8000 or http://127.0.0.1:8000
I am trying to create sub-domains on my localhost to be accessed concurrently by my team but only the first project is loaded even when the url for the second domain is typed in the browser.
So far I have tried changing the httpd-vhosts.conf file
<VirtualHost *:80>
ServerAdmin webmaster#smartsacco.localhost.com
DocumentRoot "C:/xampp/htdocs/smartsacco/public"
ServerName smartsacco.localhost.com
ErrorLog "logs/smartsacco.localhost.com-error.log"
CustomLog "logs/smartsacco.localhost.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#mfarmer.localhost.com
DocumentRoot "C:/xampp/htdocs/Mfarmer/public"
ServerName mfarmer.localhost.com
ErrorLog "logs/mfarmer.localhost.com-error.log"
CustomLog "logs/mfarmer.localhost.com-access.log" common
</VirtualHost>
And also modified the hosts file
127.0.0.1 localhost
::1 localhost
127.0.0.1 smartsacco.localhost.com
127.0.0.1 mfarmer.localhost.com
Saddly only the contents of smartsacco.localhost.com is loaded even when I type mfarmer.localhost.com. What could Be wrong or and what can I do to have them both working?
Since your code is correct, I suggest you restart Apache server and maybe the entire computer
I moved from linux to a mac. I have Apache and php setup.
Now apache seems to only load the first virtual host listed. It also only loads it in the browser via local host and not the sitename. Its been 3 days hunting the net or solutions nothing seems to work.
now if i make the document root for the virtual host eg. /Library/WebServer/Documents/ then it works. If i add an extra directory it fails eg. /Library/WebServer/Documents/livingahimsa.co.uk
here is the config: ( I have tried the doc root with quotes and without)
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
127.0.0.1 ahimsainvestments.com
127.0.0.1 livingahimsa.co.uk
127.0.0.1 ahimsavillage.com
255.255.255.255 broadcasthost
::1 localhost
and vhost:
<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/ahimsainvestments.com
ServerName ahimsainvestments.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/livingahimsa.co.uk
ServerName livingahimsa.co.uk
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Library/WebServer/Documents/ahimsavillage.com
ServerName ahimsavillage.com
pache2/httpd.conf
I am setting virtual host in my local but not success. pls help me check.
Server local info.
Zend apache2.4
system: window 7.
my config:
the content of file httpd.conf:
....
include extra/httpd-vhost.conf
....
file httpd-vhost.conf:
<VirtualHost *:80>
ServerAdmin girl.test
DocumentRoot "C:\localhost\source"
ServerName girl.test
ServerAlias www.girl.test
ErrorLog "logs\girl-error.log"
CustomLog "logs\girl-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin boy.test
DocumentRoot "C:\localhost\source"
ServerName boy.test
ErrorLog "logs\boy-error.log"
CustomLog "logs\boy-access.log" common
</VirtualHost>
File: etc/hosts I add two line
127.0.0.1/source girl.test
127.0.0.1/source boy.test
After I restart service and go to:
girl.test get message
This site can’t be reached girl.test’s server IP address could not be
found.
127.0.0.1/source is work.
pls help me check, Many thanks.
I have fixed this issue when change file etc/hosts to 127.0.0.1 girl.test 127.0.0.1 boy.test
Can you tell me please what am I doing wrong in Virtual host settings?
I am editing two files:
Apache/conf/extra/httpd-vhosts.conf and Windows/System32/drivers/etc/hosts
httpd-vhosts.conf looks like
<VirtualHost 127.0.0.1>
ServerName scouttautomotive.com
ServerAlias www.scouttautomotive.com
DocumentRoot "C:/Apache24/htdocs/scouttautomotive/web"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName bosp.sk
ServerAlias bosp.sk.localhost
DocumentRoot "C:/Apache24/htdocs/bosp/web"
</VirtualHost>
hosts file looks like
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 scouttautomotive.com
127.0.0.1 bosp.sk
What is wrong with it? I am realy confused cause bosp.sk virtual host works well.
After setting the domain ip to 127.0.0.1 to host file, You must restart your computer or flush dns cache to get that applied. Did you do?
So look at these config files and note that difference is only in the last letter of ServerName.
httpd-vhosts.conf
<VirtualHost 127.0.0.1>
ServerName scouttautomotive.com
ServerAlias scout.com.localhost
DocumentRoot "C:/Apache24/htdocs/scouttautomotive/web"
</VirtualHost>
<VirtualHost 127.0.0.1>
ServerName scouttautomotiv.com
ServerAlias drom.com.localhost
DocumentRoot "C:/Apache24/htdocs/scouttautomotive/web"
</VirtualHost>
hosts
127.0.0.1 scouttautomotive.com
127.0.0.1 scouttautomotiv.com
First version redirects me to one hosting which offers this domain to sell. Second version works well as virtual host. Both are created in the same time. So it looks command ipconfig /flushdns may not be enough.
Another possible solutions can be find here https://serverfault.com/questions/452268/hosts-file-ignored-how-to-troubleshoot Good luck!