Last night I have updated my windows 7 to windows 10.
The result is struggle trying to run my local apache server in windows 10 that is running on windows 7.I have tried uninstalling and installing another versions of xampp then I came up that I have to change the apache's default port just to make it run.
I changed httpd.conf
from Listen 80 to Listen 1234
AND
ServerName localhost:80 to ServerName localhost:1234
and in xampp control panel Config->Service and Port Settings. I also change the Main Port
Now I can access phpmyadmin using localhost:1234/phpmyadmin.
And now my problem is creating Virtual host
so I added in my host(C:\Windows\System32\drivers\etc\hosts) file
127.0.0.1 sample.local
127.0.0.1 anothersample.local
And my vhost (D:\xampp\apache\conf\extra\httpd-vhosts.conf) file
<VirtualHost *:1234>
DocumentRoot "D:/xampp/htdocs/sample"
ServerName sample.local
</VirtualHost>
<VirtualHost *:1234>
DocumentRoot "D:/xampp/htdocs/anothersample"
ServerName anothersample.local
</VirtualHost>
I did make sure the vhost file above was include
I already restarted my apache but seems like my vhost is not working .Can anyone point out what i missed?
Thank you #ShamSUP AND #maytham-ɯɐɥıλɐɯ I was able to solve my problem by uninstalling the xampp.
Then following the instructions here
I will just list the steps I have done here.
Windows+R and type appwiz.cpl and use Turn Windows features on or off and install the IIS Manager Console by expanding
Internet Information Services->Web Management Tools->then checking IIS Management Console
Windows+R and type InetMgr.exe and enter, then expand Site Right Click it then click Edit Bindings
Change the http port from 80 to 8080
After that I then install the XAMPP and configure the Virtual host
host(C:\Windows\System32\drivers\etc\hosts) file
127.0.0.1 sample.local
127.0.0.1 anothersample.local
vhost (D:\xampp\apache\conf\extra\httpd-vhosts.conf) file
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs\sample"
ServerName sample.local
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/anothersample"
ServerName anothersample.local
</VirtualHost>
And by default in windows virtual host is uncommented
After restarting apache and mysql.The Virtual host is running now.I hope this may help someone in the future.
E:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "E:/xampp/htdocs/dev2017/schools"
ServerName dev.schools
<Directory "E:/xampp/htdocs/dev2017/schools">
</Directory>
</VirtualHost>
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 dev.schools
NOTE: Restart Xampp Server.
Type URL: http://dev.schools
Maybe my issue is different.
Above answer not worked for me Windows 10, XAMPP portable 5.6.30
My XAMPP works on port 80 but when I set virtual host then its localhost also go to virtual host folder. So http://localhost also shows the content of http://mydrupal
I simply added this to /apache/conf/extra/httpd-vhosts.conf file as well.
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
<Directory D:/xampp/htdocs>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Above code was not required on Windows 7.
For virtual host - mydrupal
<VirtualHost *:80>
DocumentRoot "D:/vhosts/drupal"
ServerName mydrupal
<Directory D:/vhosts>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Hope this helps.
Related
I am working on a project using xampp server. I have more than one project. So for this I have set my httpd-vhosts like below
<VirtualHost *:8080>
ServerName khpos.com
ServerAlias www.khpos.com
DocumentRoot "D:/xampp/htdocs/pos"
<Directory "D:/xampp/htdocs/pos">
Require all granted
</Directory>
</VirtualHost>
#my second site
<VirtualHost *:8080>
ServerName demopos.com
ServerAlias www.demopos.com
DocumentRoot "D:/xampp/htdocs/demopos"
<Directory "D:/xampp/htdocs/demopos">
Require all granted
</Directory>
</VirtualHost>
Whenever I try to hit localhost:8080/demopos it's redirecting towards .../pos
hosts file
127.0.0.1:8080 khpos.com
127.0.0.1:8080 demopos.com
How to set it
Any help would be highly appreciated
You should change the portnumbers of the second etc. sites. Now all port addresses are on port 8080, if you change those to an other port number you should be fine.
<VirtualHost *:8080> to <VirtualHost *:{port-number}>
Where port-number is an other port-number
127.0.0.1:8080 khpos.com
127.0.0.1:{port-number} demopos.com
you have 2 virtual hosts defined and also the names in hosts file. Please first remove the port numbers in the hosts file:
ServerName khpos.com
ServerName demopos.com
127.0.0.1 khpos.com
127.0.0.1 demopos.com
if you call khpos.com:8080 or demopo.com:8080 it should reach your correct virtual hosts.
But: if you call localhost:8080 it will match none of your virtual hosts.
In that case Apache always enters the first virtual host matching the port that you have in your conf file ignoring its server name. That is a strange behavior of Apache - in my opinion a bug. It is exactly what you observe.
For that reason I always place a dummy virtual server in front of all others that can catch all non fitting requests with a dummy message in a simple html file.
Just a hint: you have defined
DocumentRoot "D:/xampp/htdocs/pos"
so there currently is no khpos.com:8080/pos because pos is part of the root unless you create another folder pos below
Context: fresh wampserver 3.x install (windows10)
port 80 was used by microsoft iis so i change the port using wampserver tool (right click on the icon). Wampserver manage itself to change the port with 8080.
at this moment, httpd-vhosts.conf content is
# Virtual Hosts
#
<VirtualHost *:8080>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
and hosts content is:
#
127.0.0.1 localhost:8080
::1 localhost:8080
Purpose: create virtualhost for my project like http://myproject.localdev instead of http://localhost:8080/myproject/public/
what's going bad ?
by using wampserver link to create virtualhost, i got the error message below
first VirtualHost must be localhost in c:/wamp64/bin/apache/apache2.4.33/conf/extra/httpd-vhosts.conf
I used 8080 port too and had the same problem. What I've done - in httpd-vhosts.conf I added localhost with port 80 anyway, so I had both port 80 and port 8080:
<VirtualHost *:80>
ServerName localhost
....
<VirtualHost *:8080>
ServerName localhost
After that I opened localhost:8080 - there was a warning "Port used for the VirtualHost is not an Apache Listen port". Newertheless I clicked "Add a Virtual Host". The new host was added, then I restarted DNS (WAMP - Tools - Restart DNS).
After all you can delete from httpd-vhosts.conf localhost:80
I try to use a Virtual Hosts on xampp (apache 2.4), on Windows 10.
I've been through a lot of topics and posts and tried every combination of port etc, and I couldn't make it work.
When I try to access my project it redirects me to localhost (default).
Here's my system32/drivers/etc/hosts :
127.0.0.1 localhost
127.0.0.1 yanns-properties.test
Here's my httpd-vhosts.conf :
NameVirtualHost *:8080
<VirtualHost _default_:80>
DocumentRoot "C:/xampp/htdocs/"
ServerName localhost
</VirtualHost>
# Site: yanns-properties
<VirtualHost *:8080>
DocumentRoot "C:/xampp/htdocs/yanns-properties"
ServerName yanns-properties.test
CustomLog "C:/xampp/htdocs/yanns-properties/custom.log" combined
<Directory "C:/xampp/htdocs/yanns-properties">
Options All
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I also put in my httpd.conf file :
Listen 80
Listen 8080
When I try to access yanns-properties.test, it redirects me to localhost (with list of file since I renamed index).
I tested with various port, with my project in a different folder ... I don't know what to do anymore.
Thanks for your help !
I
I am running into virtual hosts setup issues on MAMP. Here is my vhosts config
NameVirtualHost *
<VirtualHost *>
ServerName dev.local.com
DocumentRoot “/Applications/MAMP/htdocs/local”
</VirtualHost>
<VirtualHost *>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
Here is my hosts file
127.0.0.1 localhost
127.0.0.1 dev.local.com
now when visiting localhost and dev.local.com both are pointing to index of local directory. I tried various config setting in vhosts file but none is working. I am on MacBook Pro 10.10
When I first test virtual host (example.dev) I added two slightly different index.php files its directry and to localhost directory (/htdocs). My virtual host would redirect to locahost, I would know because the index.php would be the one in /htdocs. Similar to what user6166 said, I changed the code below to match the 8888 and it worked! I test example.dev:8888 and it works.
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerName dev.local.com
DocumentRoot /Applications/MAMP/htdocs/local
ServerAlias dev.local.com
</VirtualHost>
<VirtualHost *:8888>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
Then to remove 8888 change above back to 80 and MAMP preferences to:
Apache Port:80
Nginx Port:8888
mySQL Port:3306
Then inside httpd.conf change below to 80:
Listen 8888
ServerName localhost:8888
Hope that helps someone, it definely fixed my problem!
I didn't find any of the answers useful, so if other suggestions don't work for you:
Consider that the virtual hosts need to be correctly enabled/included by uncommenting
Include conf/extra/httpd-vhosts.conf in C:\MAMP\conf\apache\httpd.conf and NOT in C:\MAMP\bin\apache\conf or C:\MAMP\bin\apache\conf\original .
There're multiple locations that have MAMP configuration, make sure to uncomment that line in the correctly located file.
Changed the hosts file like this -
NameVirtualHost *:80
<VirtualHost *:80>
ServerName dev.local.com
DocumentRoot /Applications/MAMP/htdocs/local
ServerAlias dev.local.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
Enable virtual host in the right httpd.conf
Open MAMP > File > Edit template > Apache > httpd.conf
edit or add:
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
edit mamp httpd.conf
I had a similar issue with MAMP Pro 5 (after updating from version 4). One of my custom host with aliases was returning a 404 NOT FOUND error.
After a LONG troubleshoot, make sure to add the domain in the alias list.
MAMP 4
host:
test.co
alias:
sub.test.co
Becomes in MAMP 5:
host:
test.co
alias:
sub.test.co
test.co
Hope they'll get that fixed and that it helps someone!
Try to configure MAMP ports by this way:
MAMP
Preferences
Ports
Apache port: 80
Nginx port: 8888
I've had the same port values and after configurating it started working.
Open the main Apache configuration file, httpd.conf, which is located at
Applications/MAMP/conf/apache/httpd.conf
and Remove the hash (pound) sign from the beginning of the line that begins with Include:
Virtual Hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
I'm not an apache expert. But I had the same problem. I think my DNS doesn't resolve my URL.
When I ping exampl.dev everything looks fine, but when I enter example.dev in the browser I get an error. I always have to add http:// in front of the url.
I have wamp setup with quite a few websites setup as virtual hosts like this in httpd.conf
<VirtualHost 127.0.0.1>
ServerName project1.local
DocumentRoot "c:/wamp/project1/"
</VirtualHost>
I have these input in the wamp machine's host file and I can access them just fine on that machine.
127.0.0.1 project1.local
However, when I try to put an entry on my OSX machine as (192.168.1.101 being the internal ip of the wamp machine) it won't pull the page up.
192.168.1.101 project1.local
Is there something else I need to do to make this work from other machines? Thanks!
You either need <VirtualHost 192.168.1.101> (in addition to 127.0.0.1), or simply use <VirtualHost *> to put the VH on all addresses.
Just add below code in your virtual host config file
In the below code,
'Client_IP' is the IP of the machine from where you want to access the directory without using any ip on the address bar, just put severname in the address bar like 'servername/'.
<VirtualHost *:80>
ServerName servername
DocumentRoot d:\wamp\www\dir_name
<Directory "d:\wamp\www\dir_name">
Order Allow,Deny
Allow from 127.0.0.1 Client_IP
</Directory>
</VirtualHost>
Then, set same servername that you have used for the virtual host on apache server like,
server_ip servername
in the client machine c:/windows/system32/drivers/etc/hosts file.