Wamp localhost editing send me to WAMPSERVER Homepage - apache

I want to change the adress of my website from http://localhost/tests/home.html
to www.mywebsite.com.
I edited the following files as explained :
C:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
C:\wamp\bin\apache\Apache2.2.17\conf\extra\httpd-vhosts.conf
C:\Windows\System32\drivers\etc\hosts
However, i'm not redirected to home.html but to the Wamp Server Homepage.
Any idea on how to solve this ? For info, here's my httpd-vhosts.conf and hosts file.
<VirtualHost *:80>
ServerName www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 www.mywebsite.com
::1 localhost
::1 tests
::1 www.mywebsite.com
Also, note that there are more than one files in my www/tests folder, but i want to access to home.html specifically.

You also need a VH definition fot localhost when you create virtual hosts
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
And the Server name should be mywebsite.com with a ServerAlias if you want to use the www.www.mywebsite.com
<VirtualHost *:80>
ServerName mywebsite.com
ServerAlias www.mywebsite.com
DocumentRoot c:/wamp64/www/tests
<Directory "c:/wamp64/www/tests/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
Hosts file changes
127.0.0.1 localhost
127.0.0.1 tests
127.0.0.1 mywebsite.com
::1 localhost
::1 tests
::1 mywebsite.com
Once these are chnaged, remember to reset the dnscache
net stop dnscache
net start dnscache
And the restart Apache to pick up these chnages
wampmanager -> Apache -> Restart Service

Related

Xampp Apache 2.4 VirtualHost not working

I have xampp with apache 2.4 on windows 10.
i have this configuration in my C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ServerAlias www.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site3/web"
ServerName site3.localhost
ServerAlias www.site3.localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2/web"
ServerName site2.localhost
ServerAlias www.site2.localhost
</VirtualHost>
I added in my hosts file:
127.0.0.1 site2.localhost
127.0.0.1 site3.localhost
127.0.0.1 www.site2.localhost
127.0.0.1 www.site3.localhost
When i browse http://site2.localhost i see xampp root index.
When i browse http://site3.localhost i see again xampp root index.Same with www.site2.localhost...
What am I doing wrong?
A quick bit of info on Virtual Hosts. If you set one up and when you try and use it it sends you to the first Virtual Host, normally localhost it means there is something wrong with the Virtual Host definition or the HOSTS file, or you have entered the url incorrectly.
Apache will use the first VH defined in the file as the default site.
First remove these 2 lines from the HOSTS file
127.0.0.1 www.site2.localhost
127.0.0.1 www.site3.localhost
The HOSTS file should look like this
127.0.0.1 localhost
127.0.0.1 site2.localhost
127.0.0.1 site3.localhost
::1 localhost
::1 site2.localhost
::1 site3.localhost
Now each Virtual Host definition should also include some access rights like this
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site3/web"
ServerName site3.localhost
ServerAlias www.site3.localhost
<Directory "C:/xampp/htdocs/site3/web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/site2/web"
ServerName site2.localhost
ServerAlias www.site2.localhost
<Directory "C:/xampp/htdocs/site2/web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>

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

How to create virtual host for laravel 5 project

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

Vhost can't find server

I am following RiggsFolly answer, on this question and these examples and so far everything went well, but when I click on the vhost FF says that it can't find the server. How can this fixed?
I am using Wampserver 2.5.
I get this in the adress bar : http://www.cakeprebuild.com/
httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /wamp/www/CakePreBuild
ServerName www.CakePreBuild.com
<Directory "c:/wamp/www/CakePreBuild">
AllowOverride All
Require local
</Directory>
</VirtualHost>
hosts
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 localhost
127.0.0.1 CakePreBuild
::1 localhost
::1 CakePreBuild
Try these changes
Your VHOSTS Definition
<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/CakePreBuild"
ServerName cakeprebuild.com
ServerAlias www.cakeprebuild.com
<Directory "c:/wamp/www/CakePreBuild">
AllowOverride All
Require local
</Directory>
</VirtualHost>
Your HOSTS file
127.0.0.1 localhost
127.0.0.1 cakeprebuild.com
::1 localhost
::1 cakeprebuild.com
Personally I would avoid using the .com tld for sites your are developing and use something like .dev.
If a site actually existed called cakeprebuild.com having added that name to the HOSTS file would mean you would never be able to access the actual live site from this PC as you have redirected it to this PC.
I'm guessing wamp is not configured correctly for your vhost. FF (and chrome to a lesser degree) will try and help you out add the
'http://www.' and '.com'
around what you entered, if what you entered didn't return a result. Turn off wamp and type in 'localhost', you'll be redirected to
http://www.localhost.com

Virtual host - Not Found

I wolud like to use virtual host on Apache 2.4
I use Xampp and I will have more site so on it.
I have already read some guide and I have edit my httpd.config
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
and the Load
also my defalut port in busy, so I have set
Listen 8080
After that I edit my httpd-vhosts.conf in this way
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:8080>
ServerName sample.locl
DocumentRoot "C:\wwww\sample"
<Directory "C:\wwww\sample">
DirectoryIndex index.php
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:8080>
ServerName sample2.locl
DocumentRoot "C:\wwww\sample2"
<Directory "C:\wwww\sample2">
DirectoryIndex index.php
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
N.B. my site is in C:/www/sample and c:/www/sample2 and my xampp in in c:/xampp.
At the end I edit my host in system32 with
127.0.0.1 localhost
127.0.0.1 sample
127.0.0.1 sample2
Now I have 404 error, neither when I wrote: "localhost" in my url browser.
If i Understand how it work I suppose that when i write localhost it will be redirect to C:\xampp\htdocs and so I should see my xampp page but it's not so.. where did I go wrong?
I always recive
Not Found
HTTP Error 404. The requested resource is not found.
thanks in advance