As i tried to configure my virtual host on apache(xampp) in windows7
- x64.
I put something like this,
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/projects/mysite/public"
ServerName www.mysite.com
ErrorLog "logs/www.mysite.com-error.log"
CustomLog "logs/www.mysite.com-access.log" common
</VirtualHost>
And in my hosts file ( C:\\Windows\\System32\\drivers\\etc\\hosts
) i put something like this,
127.0.0.1 localhost
127.0.0.1 mysite.com
And i run it on the browser,
http://www.mysite.com
-
Server not found
Firefox can't find the server at www.mysite.com
.
Do i missed something to configure? Any ideas..
Your hosts file needs to be
127.0.0.1 localhost
127.0.0.1 mysite.com
127.0.0.1 www.mysite.com
Because mysite.com and www.mysite.com are not the same. I recommend add ServerAlias into your vhost.conf and change ServerName
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/projects/mysite/public"
ServerName mysite.com
ServerAlias www.mysite.com
ErrorLog "logs/www.mysite.com-error.log"
CustomLog "logs/www.mysite.com-access.log" common
</VirtualHost>
Try this..
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot "C:/xampp/htdocs/projects/mysite/public" #Make sure that your httpd.conf file has DocumentRoot set to your htdocs folder or the folder in which your site is in.
CustomLog logs/site.com.access.log combined
ErrorLog logs/site.com.error.log
</VirtualHost>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.