I just reinstalled XAMPP on my Win 7 machine yesterday. I am working on a Laravel project. I installed the current version of Laravel and then I went to set up the virtual host on the local machine. When I go to the url I set up (jrd_dnd_tools.localhost) I get a Bad Gateway message If I go to localhost I get the site the url is supposed to go to. I've set up virtual hosts before but no idea why this is happening. I'm sure I am missing something stupid but can't figure out what.
httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster#jrd_dnd_tools.localhost
DocumentRoot "C:\Users\Joey\Web\jrd_dnd_tools/public"
ServerName jrd_dnd_tools.localhost
ServerAlias www.jrd_dnd_tools.localhost
ErrorLog "logs/jrd_dnd_tools.localhost.log"
CustomLog "logs/jrd_dnd_tools.localhost.log" common
<Directory "C:\Users\Joey\Web\jrd_dnd_tools/public">
AllowOverride All
Order Allow,Deny
Allow from all
## --New way of doing it
Require all granted
</Directory>
</VirtualHost>
.hosts
127.0.0.1 localhost
::1 localhost
::1 database.localhost
127.0.0.1 jrd_dnd_tools.localhost
What you have mistaken is *:80, for virtual hosts never use wildcards. Instead you can do jrd_dnd_tools.localhost. Here below is my virtual host setup, I did for demo.
And also notice directory separators I have in Document Root and directory.
Make these 2 changes and your virtual host will work like a charm.
<VirtualHost t.com:80>
ServerAdmin webmaster#t.com
DocumentRoot "C:/xampp/htdocs/t"
ServerName t.com
ServerAlias t.com
## ErrorLog "logs/jrd_dnd_tools.localhost.log"
##CustomLog "logs/jrd_dnd_tools.localhost.log" common
<Directory "C:/xampp/htdocs/t">
AllowOverride All
Order Allow,Deny
Allow from all
## --New way of doing it
Require all granted
</Directory>
</VirtualHost>
Related
in my httpd-vhost.conf on macos 10.15.4,
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/theb/"
ServerName theb.localhost
ServerAlias www.theb.localhost
#DirectoryIndex index.html
<Directory "/Applications/XAMPP/xamppfiles/htdocs/theb">
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride none
</Directory>
ErrorLog "logs/theb.local-error_log"
</VirtualHost>
I have also included the virtual host in httpd.conf
Include etc/extra/httpd-vhosts.conf
Then in the host file, i have
127.0.0.1 localhost
127.0.0.1 www.theb.localhost
The issue im facing now with these configs is that whenever i browse the site in my browser,
http://www.theb.localhost, i will then be redirected to http://www.theb.localhost/dashboard ( which is the xampp default project folder). did i miss something out??
Restart Apache. Hopefully that will work.
If you have downloaded the VM version of Xampp (The one that gets mounted) then this wont work as it doesn't have access to your local files, get the non VM one here https://sourceforge.net/projects/xampp/files/XAMPP%20Mac%20OS%20X/7.4.6/xampp-osx-7.4.6-0-installer.dmg/download
Hi ive been attempting to set up a wamp server so people can access it for testing
everything works correctly on my pc and i believe i have everything set up correctly but noone can connect to the site as it cant be reached
i have opened port 80 on my router and my firewall
my hosts file is as follows
127.0.0.1 localhost
::1 localhost
127.0.0.1 bandicam.com
127.0.0.1 ssl.bandisoft.com
127.0.0.1 btcGame.local
::1 btcGame.local
my httpd-vhosts.conf is as follows
#
# Virtual Hosts
#
<VirtualHost *:80>
DocumentRoot "g:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "G:/wamp/www">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName btcGame.local
ServerAlias www.btcGame.local
DocumentRoot "c:/wamp64/www/btcgame"
ErrorLog "logs/btcGame-error.log"
CustomLog "logs/btcGame-access.log" common
<Directory "/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
is there any other things i need to change in order to get my website online?
Other people trying to access your computer should know where to look.
Your server should then be referenced in the hosts file of their machine, except that IP should be resolvable such as
your.local.ip btcGame.local
I'm using Laravel 5 for project development and I trying to configure virtual hots on wampserver.
I have changed httpd-vhost file like this:
<VirtualHost *:80>
ServerAdmin khudadadrs#gmail.com
DocumentRoot "F:/Projects/college/public"
ServerName www.college.edu
<Directory "F:/Projects/college/public">
Options Indexes FollowSymLinks
AllowOverride all
# onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
The hosts file looks like this:
127.0.0.1 127.0.0.1 www.college.edu
The problem is, when I navigate to url: www.college.edu I'm getting back to the localhost of wampserver not to my project.
I don't know what's wrong.
If a Virtul Hosts definition is incorrect Apache will default to the first defined domain in the httpd-vhost.conf file which should be localhost, for security reasons.
I would also avoid using read TLD's, I tend to use .dev
I am assuming you are using the latest WAMPServer, which includes Apache 2.4 so the security syntax has changed from Allow... to Require
See if this works better:
<VirtualHost *:80>
ServerAdmin khudadadrs#gmail.com
DocumentRoot "F:/Projects/college/public"
ServerName college.dev
ServerAlias www.college.dev
<Directory "F:/Projects/college/public">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
And the host file should look like this
127.0.0.1 localhost
::1 localhost
127.0.0.1 college.dev
::1 college.dev
I am trying to setup the virtual host for apache on Mac.
Here is my virtual host setting in /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot "/Users/Ivy/Sites/Symfony"
ServerName symfony.dev
ErrorLog "/private/var/log/apache2/symfony.dev-error_log"
CustomLog "/private/var/log/apache2/symfony.dev-access_log" common
<Directory "/Users/Ivy/Sites/Symfony">
options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Additionally, editing the file in /etc/hosts
127.0.0.1 symfony.dev
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
192.168.43.168 matrixdemo.squiz.net
But when i go to symfony.dev in the web browser, it cannot connect to. could someone help me on that?
Note: tried to restart the apache several times
Try this it will work
NameVirtualHost *:80
#Do not forget to include server name and server alias in host file
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "D:\Local server\htdocs\localhost"
CustomLog logs/localhost.access.log combined
ErrorLog logs/localhost.error.log
</VirtualHost>
You could make it
<VirtualHost symfony.dev>
ServerName symfony.dev
ServerAdmin your.mail#whatever.com
DocumentRoot "/Users/Ivy/Sites/Symfony/web"
ErrorLog "/private/var/log/apache2/symfony.dev-error_log"
CustomLog "/private/var/log/apache2/symfony.dev-access_log" combined
<Directory "/Users/Ivy/Sites/Symfony/web">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
=> "Directory" instructions should be for your root-symfony-directory/web folder, as your document root.
=> What's this "common" behind your Custom Log directory ? Did you mean "combined" ?
=> In symfony2, you need to make sure that all the requests are directed to you bootstrap - this is where rewrite engine comes in. Oh, But I see this bit has moved into the .htaccess in earlier versions of symfony :o So no need for it here. Note that you have configuration instructions for apache and symfony2 here
There is much more science behind this, but these are the parameters I use for my setup. For more info, read the docs !
I'm trying to add a virtual host to xampp server but it seems I'm missing something because the second site does not show up, localhost is displayed instead. I don't know what is wrong with these settings:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/xampp/htdocs/site1/public"
ServerName site1
<Directory "C:/xampp/htdocs/site1/public">
AllowOverride All
Order allow,deny
Allow from all
Options all
</Directory>
</VirtualHost>
I added the virtual host to the hosts file:
127.0.0.1 localhost site1
Maybe try just adding
127.0.0.1 site1.local
to your hosts file (on windows C:\windows\system32\drivers\etc\hosts)
save file and make sure to restart xampp from the control panel
Give this a try:
In your httpd-vhosts.conf file:
<VirtualHost localhost>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost site1>
DocumentRoot "c:\xampp\htdocs\site1\public"
ServerName site1
<Directory "C:\xampp\htdocs\site1\public">
Options Indexes FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
And in your hosts file:
127.0.0.1 localhost
127.0.0.1 site1
What I've done here:
Instead of using *:80, I'm using the name of the host. This gives it a more direct matching approach.
I've exchanged all forward slashed with backslashes. This doesn't really make a difference, but Windows uses backslashes - this is just a rule of thumb.
I have removed NameVirtualHost as, to my current knowledge, it does not make any difference, and thus depreciated. Future versions may recogise it as an unknown key.
Yeah, just use the solution from Mike and do not forget to uncomment line
#Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
within your httpd.conf file