I am setting a virtual host with wamp server following this tutorial
http://www.kristengrote.com/blog/articles/how-to-set-up-virtual-hosts-using-wamp
hosts file
127.0.0.1 localhost
127.0.0.1 dev.gamenomad.com
httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "C:\wamp\www\dev.gamenomad.com\public"
ServerName dev.gamenomad.com
ServerAlias dev.gamenomad.com
ErrorLog "logs/dev.gamenomad.com-error.log"
CustomLog "logs/dev.gamenomad.com-access.log" common
</VirtualHost>
<Directory C:\wamp\www>
Order Deny,Allow
Allow from all
</Directory>
httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
I am unable to access dev.gamenomad.com . I got this error
i18n-values: Missing value for "primaryParagraph"
GET http://dev.gamenomad.com/ net::ERR_CONNECTION_REFUSED http://dev.gamenomad.com/:1
fyi, my apache server listen to port 8080 instead of the default 80. Does it affect my virtual host?
For wamp, you can set a virtual host using swamp UI as well. For that, you need to left-click on wamp icon -> Your Virtual hosts -> VirtualHost Management.
Then, just enter the server name, absolute path to the folder and then create the virtual host.
You can check it yourself here
Use gamenomad.git instead dev.gamenomad.com
And directory like Document root and goto c:\windows\system32\drivers\etc
Open the "hosts" file
And goto end line and type
127.0.0.1 gamenomad.git
Save change as administrator
End
Related
Created a new Laravel project in htdocs in MAMP. Followed all the steps, added virtual hosts, changed conf file, etc/hosts, restarted mamp and my pc several times but I just can't get my virtual host to run.
however, when I am in the MAMP Dashboard I can navigate to my website -> website -> public and the default Laravel boilerplate page appears.
Has anyone had this issues with MAMP before? I gave up with XAMPP and Valet so it's my last chance here..
Specs
High Sierra 10.13.5 on 2015 MBP,
Composer version 1.6.5,
php 7.2.7
httpd.conf
# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
httpd-vhosts
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /Applications/MAMP/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "Applications/MAMP/htdocs/website/public"
ServerName website.dev
</VirtualHost>
etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
#255.255.255.255 broadcasthost
#::1 localhost
127.0.0.1 website.dev
website.dev is technically a public url, so the browser is looking for it on the internet I guess. I was trapped once in this dreadful situation. changing the name to something like website.local should solve your issue. It did for me.
Apache Server Unable to host multiple domain on single Public IP running on Windows Server 2016
Error:"Not Found The requested URL / was not found on this server." 404 Not Found
Progress so far :
1)Edited Windows hosts file "C:\Windows\System32\drivers\etc\hosts": to below
127.0.0.1 localhost
::1 localhost
127.0.0.1 koffeeroasters.com
2)Changes made in the httpd.conf file of apache is below
changed
#Include conf/extra/httpd-vhosts.conf
to
Include conf/extra/httpd-vhosts.conf
also changed
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
and added to the end of the file the following
# Tells Apache to identify which site by name
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wampstack/apache2/htdocs"
</VirtualHost>
# Tells Apache to serve Client 1's pages to "client1.localhost"
# Duplicate and modify this block to add another client
<VirtualHost 127.0.0.1>
# The name to respond to
ServerName koffeeroasters.com
ServerAlias www.koffeeroasters.com
# Folder where the files live
DocumentRoot "C:/wampstack/apache2/htdocs/koffeeroasters.com/"
# A few helpful settings...
<Directory "C:/wampstack/apache2/htdocs/koffeeroasters.com/">
Order Allow,Deny
Allow from all
# Enables .htaccess files for this site
AllowOverride All
</Directory>
# Apache will look for these two files, in this order, if no file is specified in the URL
DirectoryIndex index.html index.php
</VirtualHost>
Other details
I am using apache server on bitnami wampstack.
Site is available when typed the address "koffeeroasters.com" from the servers browser.
A reason for it which I know no solution of (refered from apache docs "https://httpd.apache.org/docs/2.4/vhosts/examples.html") :
Note :
Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.
Thanks a bunch. All help appreciated.
Try changing this:
<VirtualHost 127.0.0.1>
to
<VirtualHost *:80>
This means allow any other IPs connect on port 80, which should get you going. Trying to match the localhost is doing more than you probably need, unless you are public facing server, in which case you will not want to do this.
I'm trying to set a development server on my OSX 10.8.2. The deployed site name is mattat.org.il so I'd like to set it to mattat.dev.
These are the steps I followed:
Uncommented the include for virtual hosts, in httpd.conf:
Include /private/etc/apache2/extra/httpd-vhosts.conf
added a virtual host to httpd-hosts.conf:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/Users/matanya/Sites/matat"
ServerName mattat.dev
</VirtualHost>`
Added the server name to etc/hosts:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost.
fe80::1%lo0 localhost
127.0.0.1 mattat.dev
Restarted Apache.
Now, when i go to localhost it takes me to the directory I've set for the virtual host, instead of taking me the the root directory (i.e Sites).
When I go to mattat.dev it is unidentified as a valid url, and simply interpreted as a Google search.
What am I missing?
.dev is not a valid TLD, your browser is not treating it as a URL. http://mattat.dev should work.
For not recognising localhost, check that you have a default directory in your httpd.conf for Apache to fall back on if it cannot find a virtual host, or alternatively add a second Virtual host for localhost.
<Directory "/Users/matanya/Sites/">
Options Indexes
Order allow,deny
Allow from all
</Directory>
I am currently trying to configure the Virtual Host (Subdomain) of my Apache HTTP Server so it can be accessed with another computer on my LAN. The current setup of Apache with PHP and MySQL works locally on the same physical machine.
So I have two Virtual Host setup (development and cms) running on a non-default port of 50080. The machine of the server have a IP of 10.0.0.10. From the same physical machine, I can access the two Virtual Host using:
development.localhost:50080
cms.localhost:50080
From a different physical machine, I can access the root of the server using:
10.0.0.10:50080
But I cannot or do not know how to access the Virtual Host from the different machine. I tried something like:
development.10.0.0.10:50080
cms.10.0.0.10:50080
But they do not seem to work.
Here's how my httpd-vhosts file looks like:
NameVirtualHost *:50080
<VirtualHost *:50080>
DocumentRoot "C:/www/HTTP"
ServerName localhost
</VirtualHost>
<VirtualHost *:50080>
ServerAdmin administrator#development.localhost
DocumentRoot "C:/www/HTTP/development"
ServerName development.localhost
ErrorLog "logs/development.localhost-error.log"
CustomLog "logs/development.localhost-access.log" common
</VirtualHost>
I read some of the other post here and the Apache forum, but there's not exact case for this.
I was wondering how I can access the Virtual Host (Subdomain) from another machine and keep the same port if possible.
Thanks in advance
Ok, I figured it out, here are the configuration if anyone else is looking for this:
==================================================================================
Machine A (Apache HTTP Server):
httpd-vhost:
NameVirtualHost *:50080
<VirtualHost *:50080>
DocumentRoot "C:/www/HTTP"
ServerName localhost
ServerAlias alias <!-- Added -->
</VirtualHost>
<VirtualHost *:50080>
ServerAdmin administrator#development.localhost
DocumentRoot "C:/www/HTTP/development"
ServerName development.localhost
ServerAlias development.phoenix <!-- Added -->
ErrorLog "logs/development.localhost-error.log"
CustomLog "logs/development.localhost-access.log" common
</VirtualHost>
hosts:
127.0.0.1 development.localhost
127.0.0.1 alias
127.0.0.1 development.alias
==================================================================================
Machine B (Guest Machine):
hosts:
10.0.0.10 alias
10.0.0.10 development.alias
From the second machine, you should be able to access with "alias" and "development.alias"
I suggest making the following change (add the ServerAlias lines):
NameVirtualHost *:50080
<VirtualHost *:50080>
DocumentRoot "C:/www/HTTP"
ServerName localhost
ServerAlias cms.myserver.com
</VirtualHost>
<VirtualHost *:50080>
ServerAdmin administrator#development.localhost
DocumentRoot "C:/www/HTTP/development"
ServerName development.localhost
ServerAlias development.myserver.com
ErrorLog "logs/development.localhost-error.log"
CustomLog "logs/development.localhost-access.log" common
</VirtualHost>
Restart Apache to ensure the changes take effect.
Then on your second computer you need to add a custom dns entry for these new domain names. If it is Windows, edit the file c:\windows\system32\drivers\etc\hosts. If it is Linux, edit /etc/hosts. Either way add:
10.0.0.10 development.myserver.com
10.0.0.10 cms.myserver.com
Now on your second computer you should be able to access the following URLs:
http://development.myserver.com:50080
http://cms.myserver.com:50080
Unless I'm missing something, you'll need to either set up DNS entries, or add entries to the /etc/hosts file of each computer accessing the server.
localhost is an entry that exists in everyone's /etc/hosts file by default, always pointing to 127.0.0.1. Without adding a /etc/hosts entry, developer.localhost doesn't exist, and prefixing an ip address with a subdomain won't work at all.
Using a SSH + Putty tunnel, and thus having a 127.0.0.1 on my server, I managed to access my subdomains by doing the following on my server side:
# nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
127.0.0.1 sub1.domain.com sub2.domain.com sub3.domain.com sub4.domain.com
I did not change the host file of the remote computer, and it works like a charm
For Named Virtual Hosts you need to use a hostname or domainname to connect to you apache server. It does not work with ips.
You could insert an entry in your /etc/hosts on your second system.
I have an apache server installed on my portable windows 7 machine using xampp as an interface. I've been working with a few people on an irc channel but must soon go to bed and replies are getting slower.
I have the following code added to my httpd.conf file:
#virtual servers
#Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost.MEALS
DocumentRoot C:\xampp\htdocs\MEALS
DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
ServerName localhost.HA
DocumentRoot C:\xampp\htdocs\Hackers
DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
ServerName localhost.WIK
DocumentRoot C:\xampp\htdocs\WhoIKnow
DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
ServerName localhost.TUS
DocumentRoot C:\xampp\htdocs\Unity
DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
ServerName localhost.PHP
DocumentRoot C:\xampp\htdocs\phpMyAdmin
DirectoryIndex index.php
</VirtualHost>
And I have the following configuration:
Setting environment for using XAMPP for Windows.
John#ASSIMILATER C:\xampp
# httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
_default_:443 localhost (C:/xampp/apache/conf/extra/httpd-ssl.conf:80)
*:80 is a NameVirtualHost
default server localhost.MEALS (C:/xampp/apache/to which there was conf/httpd.conf:512)
port 80 namevhost localhost.MEALS (C:/xampp/apache/conf/httpd.conf:512)
port 80 namevhost localhost.HA (C:/xampp/apache/conf/httpd.conf:516)
port 80 namevhost localhost.WIK (C:/xampp/apache/conf/httpd.conf:520)
port 80 namevhost localhost.TUS (C:/xampp/apache/conf/httpd.conf:524)
port 80 namevhost localhost.PHP (C:/xampp/apache/conf/httpd.conf:528)
Syntax OK
John#ASSIMILATER C:\xampp
#
However when I try to access localhost.PHP in my web browser it tells me the server is not found. I was instructed that I need to resolve the host names on my machine. I was directed to a few irc channels (dns and windows) to which there was no reply. I searched google and ran across this site: http://technet.microsoft.com/en-us/library/bb727005.aspx#EEAA. I'm not quite sure what I'm reading and as near as I can tell it doesn't quite give me a clear instruction on where to resolve the host name or a file to edit.
Also currently the default server is the top virtual server in the code. I would like to call localhost and show a simple html page I created which is in "htdocs/index.html" which will navigate to the other servers (links pointing to "localhost.PHP" etc). is there a way to have the default server remain "localhost" which points to "htdocs/index.html" while maintaining the other virtual servers, or will I have to create another virtual server and make that the default?
Any and all help appreciated.
edit: I had someone help me find the HOSTS file on my machine but am unable to edit it. I turned off all antivirus features, turned off spybot (UAC was always off and I always run with administrator privileges) specifically right clicked on np++ editpadlite and windows notepad and was only able to edit in notepad, but was required to save the file with a different name.
You have to explicitly run Notepad as an administrator (regardless of UAC settings) and when you go to save, make sure you select 'all files' rather than the default *.txt.
I found the same thing when I tried to edit the hosts file on W7, but it seems that just being an administrator on the machine isn't quite the same as explicitly running the program as an administrator.