I have installed wamp on C:/wamp64/ folder
I have created a virtual host called sampleapp.dev. But when I access it It says "This site can’t be reached".
my httpd-vhosts file
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName sampleapp.dev
DocumentRoot "C:/wamp64/www/sampleapp/public"
</VirtualHost>
my hosts file
127.0.0.1 localhost
::1 localhost
127.0.0.1 sampleapp.dev
::1 sampleapp.dev
What I am doing wrong?
<VirtualHost *:80>
ServerName sampleapp.dev
ServerAlias sampleapp.dev
DocumentRoot "C:/wamp64/www/sampleapp/public"
</VirtualHost>
<Directory "C:/wamp64/www/sampleapp/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
my setting
it's working
As you can see from the Definition of the localhost Virtual Host, you need more than just the name of the VH defined, you also have to tell Apache who is allowed to access your new Virtual Host.
The <Directory...> block tell Apache this, specifically the Require local piece, but the other parameters also tell Apache useful information about whats allowed to be done in this new VH.
Try the below amendment.
I have changed sampleapp.dev to sampleapp.test. This is because if you ever use the Chrome browser, the .dev tLD does some odd things now. Google bought the .dev tLD and Chrome now will try and enforce the use of SSL (https) on all .dev tLD's. Simple solution it to just use something else like .local or .test
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName sampleapp.test
ServerAlias www.sampleapp.test
DocumentRoot "${INSTALL_DIR}/www/sampleapp/public"
<Directory "${INSTALL_DIR}/www/sampleapp/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
As I use .test instead of .dev yo will also have to change your HOSTS file accordingly, and then reboot or refresh your dnscache like this from a command window started using "Run as Administrator".
Also avoid using Require all granted unless you actually want to allow the universe into your server. If your router blocks port 80, which they do by default nothing can actually get into your WAMPServer. But the second you decide you want to show a friend your nice new site and Port Forward port 80 to your WAMPServer PC, all sites that use Require all granted will become visible. Best to make that change only on the site you really want to be visible from the internet.
>net stop dnscache
>net start dnscahce
Related
I have made a virtual host on Ubuntu and It is redirecting it to https.
and virtual hosts not working.
here is virtual host settings:
<VirtualHost *:80>
ServerName xserver.dev
DocumentRoot /var/www/xserver/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/xserver/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xx-error.log
CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
</VirtualHost>
i have added it in /etc/hosts
127.0.0.1 xserver.dev
when I try to access xserver.dev
It is redirecting me to https://xserver.dev and blank page
I am unable to access file files too. which are available on the given path
The .dev is a top-level domain name operated by Google.
Since Chrome 63, and Firefox 59, the browsers redirects the .dev URLs to HTTPS.
It is recommended to use .test, reserved by the Internet Engineering Task Force since 1999 (RFC2606).
Change you virtual host to:
<VirtualHost *:80>
ServerName xserver.test
DocumentRoot /var/www/xserver/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/xserver/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xx-error.log
CustomLog ${APACHE_LOG_DIR}/xx-access.log combined
</VirtualHost>
And your /etc/hosts to:
127.0.0.1 xserver.test
Then, access to your website : http://xserver.test
I am trying to access my web app from my phone connected via same router but I am being able to only access the localhost home page but when I click on the respective virtualhost, I am not being able to access the page.
I have setup my virtual host through the interface provide in wamp server.
Wamp Server Version: 3.0.6
httpd-vhosts.conf
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp64/www
<Directory "D:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
#Require local
Require all granted
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName transmit
DocumentRoot "d:/wamp64/www/transmit_renewed"
<Directory "d:/wamp64/www/transmit_renewed/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
#Require local
Require all granted
</Directory>
</VirtualHost>
I have some virtual-host and I can access it on the PC that has the server intalled. But I have others Pc and I want to access via the domain name.
I just can access to the server configuration page changing the statement "Require local" to "Require all granted". This only allow me to access through the ip address.
<VirtualHost *:80>
ServerName localhost
DocumentRoot D:/wamp64/www
<Directory "D:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName laravel5.1.app
DocumentRoot "d:/wamp64/www/laravel5_1/public"
<Directory "d:/wamp64/www/laravel5_1/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
To access the site using your domain names you must tell each of the other PC's where to find the domain name.
So you either need a local DNS Server or you edit the HOSTS file on each PC that you want to access the site from by adding something like this to the other PC's HOSTS
192.168.1.100 laravel5.1.app
Assuming your WAMPServer (Apache) is running on ip address 192.168.1.100
I have created a virtual host for a new application in wamp.
In my httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf //<--- Removed #
In my httpd.vhosts.conf I added a new host
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "C:/wamp/www/myapp"
ServerName myapp.local
ServerAlias 127.0.0.1
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/myapp/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
</Directory>
</VirtualHost>
The virtual host is working fine. But the problem is my other apps that run without virtual hosts are not working.
When i open http://localhost/fistapp/ it shows
Forbidden 403
You don't have permission to access / on this server.
Once you create a Virtual Host definition Apache basically ignores the localhost domain defined in the httpd.conf file, so you have to also define locahost in the httpd-vhosts.conf file as well. So your httpd-vhosts.conf file should look like this :
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp/www
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
# made some amendments to this VH as well
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/myapp"
ServerName myapp.local
# not sure why this is here ServerAlias 127.0.0.1
ServerAlias www.myapp.local
SetEnv APPLICATION_ENV "development"
<Directory "C:/wamp/www/myapp">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride all
Require local
</Directory>
</VirtualHost>
Dont forget to amend the C:\windows\system32\drivers\etc\hosts file to add your new domain like this
127.0.0.1 localhost
::1 localhost
127.0.0.1 myapp.local
::1 myapp.local
Looking for some help with setting up a subdomain in XAMPP.
I've read a few articles, whilst they seem to be all related to local installs, what I have is a PORTABLE version of XAMPP so there is no drive prefix.
I tried some of the mentioned articles below but none seem to work. They all display a server not responding or end up going to google to search.
I have in httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then in extra/httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *>
ServerAdmin admin#localhost.com
ServerName localhost
ServerAlias localhost
DocumentRoot "/xampp/htdocs/public"
<Directory "/xampp/htdocs/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost forums*>
ServerAdmin admin#localhost.com
ServerName forums
ServerAlias forums
DocumentRoot "/xampp/htdocs/public/forums"
<Directory "/xampp/htdocs/public/forums">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
When I do this "forums.localhost" is turns into this in chrome "http://www.forums.localhost/" and then I get:
The webpage is not available
Amongst many I have read, some mention editing windows hosts file, but given this is a PORTABLE version of XAMPP I can't always go editing the hosts file in every computer.
these were few I tried but they all fail
http://austin.passy.co/2012/setting-up-virtual-hosts-wordpress-multisite-with-xampp-on-windows-7/
https://community.apachefriends.org/f/viewtopic.php?p=198815&sid=7a72729a95ed298148f8635dd414295a
how to create subdomains in apache(xampp) server?
Can someone please help me how to get subdomain to work on a PORTABLE version or how I should be doing it, or is editing windows hosts file compulsory?
not tested but try this:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin#localhost.com
ServerName localhost
ServerAlias localhost
DocumentRoot /xampp/htdocs/public
<Directory "/xampp/htdocs/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin#localhost.com
ServerName forums
ServerAlias forums
DocumentRoot /xampp/htdocs/public/forums
<Directory "/xampp/htdocs/public/forums">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Don't forget to write
127.0.0.1 forums
to your hosts file, if you don't have a DNS-Server.
You need to add forums.localhost to your hosts file.
Edit %SystemRoot%\System32\drivers\etc\hosts and add 127.0.0.1 forums.localhost.
I don't think there is another way to do this, sorry (maybe creating a script that automatically edits the hosts file, but it's quite dirty).