I'm trying to set up dynamic VirtualHosts subdomains using Apache 2.4 on Windows 8.1 with Acrylic DNS Proxy, but I'm running in to problems with Server Not Found errors. I've read so many answers already, like this one, but I can't figure out what's wrong or how to fix it.
My aim is to set up a local domain (http://localhost.pc) to serve all subdomains dynamically from folders in /htdocs, so http://test.localhost.pc/ from /htdocs/test/ etc. My VirtualHost config is set up as
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias localhost.pc www.localhost.pc
DocumentRoot C:/dev/apache/htdocs/
<Directory />
Options FollowSymLinks Includes ExecCGI Indexes
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias *.localhost.pc
VirtualDocumentRoot C:/dev/apache/htdocs/%1/
<Directory />
Options FollowSymLinks Includes ExecCGI
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I've installed Acrylic DNS Proxy, I've changed the IPv4 DNS server to 127.0.0.1 for my WiFi and my (disconnected) Ethernet, and I've edited AcrylicHosts.txt to include the line
127.0.0.1 localhost.pc *.localhost.pc
Acrylic seems to work fine, I've enabled the debug log and hit log and regular internet browsing works fine. However, if I visit my local domain or subdomains I get the server not found error despite Acrylic's debug log saying
TResolver.Execute: Request ID 34019 received from client 127.0.0.1:55587 [Q=localhost.pc;T=AAAA;Z=84E301000001000000000000096C6F63616C686F737403706D6100001C0001].
TResolver.Execute: Response ID 34019 sent to client 127.0.0.1:55587 directly from hosts cache.
And the hit log saying
127.0.0.1 H Q=localhost.pc;T=A
127.0.0.1 H Q=localhost.pc;T=AAAA
Pinging localhost.pc from the command line fails (could not find host), but nslookup looks right
C:\>nslookup localhost.pc
Server: UnKnown
Address: 127.0.0.1
Name: localhost.pc
Addresses: 127.0.0.1
127.0.0.1
If I then add 127.0.0.1 localhost.pc to C:\Windows\System32\drivers\etc\hosts and flush the DNS cache, I can at least get http://localhost.pc/ to load. The whole point of Acrylic is being able to use wildcards, but http://test.localhost.pc only works if I manually add it, and any other subdomain/folder, to the Windows hosts file.
So I'm guessing Acrylic is the problem if adding entries to the Windows hosts file manually gets things working. Does anyone have any ideas what is going wrong and how to fix it?
I've fixed a bug regarding AAAA queries not resolved properly from the AcrylicHosts.txt file in versions <= 0.9.27.
If you use the latest (0.9.28) version you should be fine.
Related
I have been trying to configure Laravel but it seems to have some kind of error: "IP address could not be found."
This is my configuration in my httpd-vhost.conf
Configuration on httpd-vhost
and this is what I put in my host
enter image description here
I tried restarting and checking my syntax through httpd.exe -t in apache but it seems okay
You can try this.
In your httpd-vhost.conf file write this, If you want virtual host of reviewer then try this,
<VirtualHost *:80>
ServerName reviewer.test
ServerAlias reviewer.test
DocumentRoot "C:/xampp/htdocs/reviewer/public"
DirectoryIndex index.php
<Directory "C:/xampp/htdocs/reviewer/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
And in your hosts file write this,
127.0.0.1 reviewer.test
Then restart your all xampp server services.
Problem in your files
You haven't removed the comment ( # this symbol represents that it is comment.)
This is your file configuration.
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# 127.0.0.1 reviewer.dev
You have to remove # this symbol, and replace dev with test . Get more knowledge from this link.
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
127.0.0.1 reviewer.test
I hope this stuff will help you.
I'm trying to publish a locally installed WordPress website - publically.
Had to reformat my laptop, so now running Windows 10 from my laptop at home.
I can already RDP to it from e.g. work PC, externally, etc.
I used to have Windows 8, WAMP installed and used to publish websites to my domain - www.site01.co.uk
site01.co.uk has been pointing to my fixed IP since I had Windows 8 and still is pointing. The fixed IP address hasn't changed.
I now opened up XAMPP httpd.conf and placed below "code" at the bottom:
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\wp"
servername http://www.site01.co.uk
<Directory "C:\xampp\htdocs\wp">
Allow from all
Require all granted
Options Indexes
</Directory>
</VirtualHost>
This didn't work .
WordPress is installed in htdocs\wp folder.
You have a couple of problems with your Virtual Hosts definition. Virtual Hosts is definitely the way to go though.
When you create a Virtual Host Apache ignores the default definition of localhost in your httpd.conf file so its always a good idea to include a VH definition for that as the first VH defined, with access limited to Require local this helps stop drive-by ip address access attempts as the Require local will return an Access denied if you/they just use your WAN ip to try and see whats on your web server.
This should go in the \xampp\apache\conf\extra\httpd-vhosts.conf file. Remove all the example stuff from that file when you add this definition.
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
<Directory "C:\xampp\htdocs">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\wp"
ServerName site01.co.uk
ServerAlias www.site01.co.uk
<Directory "C:\xampp\htdocs\wp">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Apache 2.4 uses the Require parameter and not the Allow/Deny which was Apache 2.2 syntax.
You now edit the httpd.conf file and find the
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
and remove the # comment like so
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then make sure that the Port Forwarding on your router is forwarding port 80 to the correct ip address for your PC.
Im trying to set up a virtual host using my local xampp stack but after following many tutorials i simply can't work out where im going wrong.
Here is what i added to my httpd-vhost.conf file:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot E:\Programs\xampp\htdocs
</VirtualHost>
<VirtualHost *:80>
DocumentRoot E:\Programs\xampp\htdocs\CVCMS
ServerName cvcms.dev
<Directory "E:\Programs\xampp\htdocs\CVCMS">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And here is my hosts file
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 lmlicenses.wip4.adobe.com
127.0.0.1 lm.licenses.adobe.com
127.0.0.1 cvcms.dev
I have restarted apache after every change, i have made sure http.conf is linked to the httpd-vhosts file.
The issue is when i type in the domain cvcms.dev it shows the xampp splash page instead of the index.php in my cvcms folder.
Any ideas why?
Thanks
please remember to add the quotes to your virtual host document root path. At the same time what you need to to do enable them is to find httpd.conf , in this version it should be in your etc folder within your XAMPP's root folder.
Look out for :
# Virtual hosts
#Include etc/extra/httpd-vhosts.conf
Since '#' is a comment prefix, you have to uncomment "#Include etc/extra/httpd-vhosts.conf"
See if this works. Remember to restart your XAMPP's apache server to read the new settings you've just set. Cheers !
You can read more on this here.
So i have a public network VM set up with Vagrant and PuPHPet to get an apache web server up and running. I'm using Laravel as my framework of choice. I can access my site in my browser by visiting the following:
http://192.168.1.14/public/index.php/
Using PuPHPet i configured my vhost to use "phptest.dev" as the Server Name.
I'm a little stuck on how i should set a vhost to prettify my url. I'm not sure where the "phptest.dev" server name comes into play. I can't ping phptest.dev and get anything back.
What is the proper way to set this up? I'd like to visit "phptest.dev" in my browser to see my site. I think i need to add an .htaccess file to route all requests through the 'public/index.php` file so i can get that out of the url but i'm not sure.
Don't know PuPHPet but I can answer in a generic way.
You can use /etc/hosts file to do name resolution, as long as you haven't changed /etc/nsswitch.conf.
For example in /etc/hosts, add
192.168.1.14 phptest.dev
You should be able to ping the hostname from within the VM.
Suppose you are using Debian/Ubuntu, the sites configuration file is in /etc/apache2/sites-available/phptest.dev.conf
NOTE: don't forget to create a symbolic link in sites-enabled
<VirtualHost *:80>
ServerAdmin EMAIL
DocumentRoot /path/to/php
ServerName phptest.dev
ServerAlias www.phptest.dev
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /path/to/php>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/phptest.dev-error_log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/phptest.dev-access_log combined
</VirtualHost>
Do a service apache2 reload or restart and see if you can access by using phptest.dev
I can't respond directly to Terry Wang, but he's mostly right.
Ignore everything past his 4th line, though, because PuPHPet takes care of setting up the vhost in your VM for you.
You simply need to tell your local machine (your Mac or your Windows or maybe your Linux machine) that the domain phptest.dev is located at ip address 192.168.1.14.
That's why you need to edit your hosts file.
I am running XAMPP 1.7.3 on windows 7. My problem is that when I try to access my server (localhost) from another computer, the server does not respond. For example, [on my computer] when I type in 'http://localhost', my pages come up. However, when I try accessing 'http://192.168.0.102' from my computer, nothing happens. When I type in my external IP, nothing shows up, but when add HTTPS to the external IP, my Linksys WRT54GS config page shows up, asking for a password. I have already tried port forwarding and a local "static IP", and no luck, other than my local IP never changing. Can anyone help me?
Here's how I have my XAMPP installation configured. Maybe it will work for you.
Open C:\xampp\apache\conf\extra\httpd-vhosts.conf
Add a VirtualHost block for each site you are running:
Apache config
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot C:/path/to/website/files
ServerName exampledomain.dev
<Directory "C:/path/to/website/files">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Add a line to your hosts
127.0.0.1 exampledomain.dev
On the connecting computer's host file:
192.168.0.102 exampledomain.dev
You can easily access your hosts file by using ctrl+r and running
notepad %SYSTEMROOT%\system32\drivers\etc\hosts