WAMP missing localhost in URL - apache

Hoping to catch the attention of user RiggsFolly (or any knowledgeable person) as I am having issues getting the virtual hosts list to appear as described here: http://forum.wampserver.com/read.php?2,127757
My hosts file:
127.0.0.1 localhost
127.0.0.1 testing
::1 localhost
::1 testing
My http-vhosts file:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/testing"
ServerName testing
<Directory "c:/wamp/www/testing">
AllowOverride All
Require local
</Directory>
</VirtualHost>
I have uncommented the "Include conf/extra/httpd-vhosts.conf" line in the http.conf file. I stopped and restarted the dnscache, and restarted and refreshed the wamp service several times. I have added the ';WAMPVHOSTSUBMENU' line in the right place in the wampmanager.tpl file.
Basically I followed the guide to the letter and the list of vhosts just won't appear. I know that I am not alone in this issue, I can see others with it out there but I cannot find a solution.
Any help appreciated.

Related

virtual host for xampp on Mac

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

OS X Apache2 vhosts hosts domain not working

Setting up my local dev environment due to an update in OS X pushing new Apache Files.
This setup works fine when going to localhost or http://127.0.0.1 but when I setup the hosts file like so
127.0.0.1 bears.dev www.bears.dev
bears.dev just comes up with "This site can't be reached" in chrome.
Below is my vhosts configuration setup. I'm stumped as to why this isn't work, i'm pretty sure it worked previously.
<VirtualHost *:80>
ServerName bears.dev
ServerAlias www.bears.dev
DocumentRoot "/Users/Bears/Dev"
ErrorLog "/private/var/log/apache2/bears.dev-error_log"
CustomLog "/private/var/log/apache2/bears.dev-error_log" common
ServerAdmin superbear9000#gmail.com
<Directory "/Users/Bears/Dev">
Options FollowSymLinks Indexes
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Thanks for the assistance!
In hosts file don't add two domains in line
right way is:
127.0.0.1 www.bears.dev
127.0.0.1 bears.dev

wamp server put online for anyone to access

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

Problems in setting up VirtualHost using WAMP server

I want to host multiple websites on my computer. I'm using Windows with WAMP server. I already have domains and know how to map them to ip.
I have already edited httpd.conf file to allow virtual hosts.
My httpd-vhosts file looks like this,
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www"
ServerName localhost
ServerAlias localhost
<Directory "C:/wamp64/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/testcase"
ServerName test.mydomain.com
<Directory "C:/wamp64/www/testcase">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/test2"
ServerName test2.mydomain.com
<Directory "C:/wamp64/www/test2">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
The problem is that both my domains open only the first site in this VirtualHost tag.
Example: In this case, both my domains will open the WAMP server configuration page. If I were to move the "testcase" tag above the other, both my domains will open the "testcase" page.
Update:
My subdomains show corresponding pages successfully when I open them on the server. But when I open subdomains on another machine, they open the first entry in the VH.
Update 2: Okay, so this is just out of my understanding now. I thought may be WAMP is not my cup of tea. So I installed XAMPP and made changes to the VH configuration and still ended up with same problem. So I then got rid of XAMPP too and installed WAMPDeveloper Pro. What could go wrong when the software sets up all the configuration files for you, right? But to my surprise, I still have the same problem. The websites work fine when I open them (using actual domain name) on the server itself, but when I open them on machine outside network the first VH entry open for all the domains I open.
Can anyone please help me with this?
Thanks!
Using both Apache2.2 and Apache2.4 syntax gets Apache a litle confused.
So as I assume you are running Apache 2.4 change the VH defs to this
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/testcase"
ServerName test.mydomain.com
<Directory "C:/wamp64/www/testcase">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/wamp64/www/test2"
ServerName test2.mydomain.com
<Directory "C:/wamp64/www/test2">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why Apache opens the first site i.e. localhost in this case.
If Apache cannot make sense of a VH def, it ignores it and default to loading the first Virtual Host that was correctly defined in the httpd-vhosts.conf file.
Of course you will also need to amend your c:\windows\system32\driverrs\etc\hosts file to include these domain names
127.0.0.1 localhost
127.0.0.1 test.mydomain.com
127.0.0.1 test2.mydomain.com
::1 localhost
::1 test.mydomain.com
::1 test2.mydomain.com

Both virtual hosts go to default

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