I am a complete novice when it comes to WAMP, apache etc.
I'm trying to get a site to run locally but so far not having any luck. I've got as far as installing WAMP and it seems to be going online fine, i.e. the green "W" icon is green. Features like phpmyadmin seems to be working. When I click "localhost" it opens the browsers and navigates to localhost as you'd expect, however, all I see is the directory listing.
So, I have virutal hosts set up as follows:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
ServerAlias bts
<Directory "c:/wamp/www/bts/BiteTheSun">
Require all granted
</Directory>
</VirtualHost>
and in my hosts file I have:
127.0.0.1 localhost
127.0.0.1 bts
::1 bts
::1 localhost
I've added some images just to be clear as to the issue - the top image shows what I think I should be seeing and the bottom shows what I actually see:
localhost screenshot issue
I've tried everything I can think of to no avail. It might also help to mention that in the log file [apache_error.log] I seem to get errors relating to permissions:
"AH01630: client denied by server configuration: C:/Apache24, referer: http://localhost/"
However, I've gone through the permissions set in the config files using examples from several sources and nothing seems amiss.
Has anyone any idea what is going on here? I have searched online high and low on this and on one else seems to have exactly this issue which makes me think it is me doing something very silly - I just need someone to point out how exactly! :)
Richard
Is there an index file in your www folder?
Typically, you want to place your individual projects within the www folder and point your virtual hosts to the www/your-project/ folder which should contain an index.php file (unless you have a custom set up where you are going to point your virtual host directly to a specific file).
Your Virtual Host definitions are incomplete.
Each VH should have its own <Directory>...</Directory> definitions so you can apply the access and other config information to that directory.
The parts you are missing are AllowOverride and Options.
The other thing to remember is that when you create a Virtual Host environment the host defined in the httpd.conf file is basically ignored and the VH's take presidence. This is why you need to redefine the localhost in the VH file.
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/bts/BiteTheSun"
ServerName bts
<Directory "c:/wamp/www/bts/BiteTheSun">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
Your AH01630: client denied by server configuration: C:/Apache24 error is likely because the default httpd-vhost.conf file comes with 2 example definitions as supplied by Apache. These should be completely deleted from the file. So if you left these in the httpd-vhost.conf file. Delete them completely from the file.
Example of the defs to remove. Note they use the c:/Apache24 directory which does not, and should not exist in a WAMPServer environmant!
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
Related
I just started learning php and I am trying to host locally my own php website by using XAMPP.
I wanted to create virtual host with:
URL: myphpwebsite.local
Port: 8088
But when I attempted to access this website through the browser I got a:
Not Found
HTTP Error 404. The requested resource is not found.
Does anyone know what the problem is?
My httpd-vhosts.conf
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost myphpwebsite.local>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And my C:\Windows\System32\drivers\etc\hosts file:
127.0.0.1 localhost
127.0.0.1 myphpwebsite.local
Any help would be appreciated!
make sure there's file/htaccess/index or whatever in directory you want to open, 404 may comes from that ;)
try using one below, eventually replace your port:
<VirtualHost *:80>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
</VirtualHost>
the question is your Apache running/serving on port 8088?
For example my xamp is running on 80 and 443...
xamp control panel is very handy, it has nice logs button that will open your log files to show you php and apache errors etc. check it out.
Try going with default port, if it works it means that you need to play with ports if you really want to.
just a quick tip, .com is shorter than .local and if you're using chrome and it works like mine then most of the time something.local will redirect you to google search (and I like my search there, you can switch it off ;))
I don't know if I am much help, but using WAMP, here are my settings. I am listening on port 80, I use 8080 for my tomcat server.
hosts file
127.0.0.1 local.mysite.com
httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
....
<Directory "c:/wamp/www">
Options Indexes MultiViews FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "c:/wamp/www"
</VirtualHost>
<Directory "c:/wamp/www/path/to/site/root">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName local.mysite.com
DocumentRoot "c:/wamp/www/path/to/site/root"
ServerAdmin me#email.com
ProxyPreserveHost Off
RewriteEngine On
AllowEncodedSlashes NoDecode
#AllowEncodedSlashes On
ErrorLog "c:/wamp/www/path/to/logs/error.log"
CustomLog "c:/wamp/www/path/to/logs/access.log" common
</VirtualHost>
....
Then I can access my local site like this: http://local.mysite.com
Hope this helps...
The NameVirtualHost directive needs to match the value of VirtualHost exactly, and you need to specify the port in each instance. If you want to use port 8088 for myphpwebsite.local, you'd need to do:
NameVirtualHost 127.0.0.1:8088
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost 127.0.0.1:8088>
DocumentRoot "C:/Microsoft/Workspace/myphpwebsite"
ServerName myphpwebsite.local
ErrorLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.error.log"
CustomLog "C:/Microsoft/Workspace/myphpwebsite/logs/myphpwebsite.local.custom.log" combined
<Directory "C:/Microsoft/Workspace/myphpwebsite">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Notice the VirtualHost opening tags are identical; it's the ServerName value that actually tells Apache which domain this particular directive applies to. Restart your server after making the changes. Check out this page for more information: http://httpd.apache.org/docs/2.2/vhosts/name-based.html
Hope this helps!
Make sure that the port you are using is not being used by another service.
This problem has been bugging me for days and I really need an answer.
I have a previous WAMP server in which I have configured properly so I can set up virtual hosts for applications that I build. It served me well for months.
Recently, there's this software, in which I think is a Malware, that run in my pc. The software was removed and I scanned the pc and there were no viruses.
I re-installed WAMP server and configured it again. It went well but the virtual hosts are not behaving properly.
These are what I have declared:
In httpd-vhost:
<VirtualHost *:80>
ServerAdmin #removed
DocumentRoot "c:/wamp/www/Thesis"
ServerName pixtcha.dev
<Directory "c:/wamp/www/Thesis">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin #removed
DocumentRoot "c:/wamp/www/mvc-pe-system/web"
ServerName copers.com
<Directory "c:/wamp/www/mvc-pe-system/web">
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
</Directory>
</VirtualHost>
In my hosts file:
127.0.0.1 pixtcha.dev
127.0.0.1 copers.com
The thing is, I am able to access the pixtcha.dev properly and there were no problems, while the copers.com is inaccessible, when I type it, it redirects me to some website from the web. I just don't understand why this happens. I even tried flushing the dns if there were corrupted local files but I just can't figure it out.
Also, I have tried using the server names from my previous virtual host and they are all inaccessible too. They are giving me:
http://copers.edu.ph is not available
So I resorted to using new server names, but I don't understand why can't I use the previous server names from my previous WAMP configuration. :(
What do you think are the problems? And how to solve them?
Please help. Thanks in advance.
Ok a couple of things that might help here.
As Apache 2.4 is IPV4 and IPV6 aware you need to change your HOSTS file like this so if the browser decides to use IPV6 it knows where to find your domains. I wish I knew what controls the broswers decision, but I dont.
127.0.0.1 localhost
127.0.0.1 pixtcha.dev
127.0.0.1 copers.com
::1 localhost
::1 pixtcha.dev
::1 copers.com
Dont forget to restart the dnscache or reboot after changing this file.
From a command windows, started using the 'Run as Administrator' option, do these 2 commands to restart the dnscache.
net stop dnscache
net start dnscache
Also when you create Virtual Hosts the default host, as defined in httpd.conf, is ignored, so you need to add a VHOST definition for localhost.
Also you are using old Apache 2.2 syntax in your VHOST definitions, incorrectly as well as it happens, and this should be changed to Apache 2.4 syntax
Also it is better to stick to lower case for directory names, Windows does not care but if you ever move code to a Unix live server it may cause confusion.
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin #removed
DocumentRoot "c:/wamp/www/thesis"
ServerName pixtcha.dev
<Directory "c:/wamp/www/thesis">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin #removed
DocumentRoot "c:/wamp/www/mvc-pe-system/web"
ServerName copers.com
<Directory "c:/wamp/www/mvc-pe-system/web">
Options Indexes FollowSymLinks
AllowOverride all
Require local
</Directory>
</VirtualHost>
Check and make sure that your scripts (PHP?) in your copers.com root (index.php?) are not redirecting to these outside URLs, or to URLs further inside your local site that would redirect outside as well.
Also in Chrome, you can open the Network tab of Developer Tools to see what actual web requests are being made, and in what order.
I am using a wamp version 2.5
My Apache is 2.4.9
PHP: 5.5.12
MySQL: 5.6.17
I have these configurations:
On my httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
On my G:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhost.conf
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "g:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "g:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "g:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "g:\wamp\www\mysite\public"
ServerName mysite.dev
</VirtualHost>
On my c:\Windows\System32\Drivers\etc\hosts
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
127.0.0.1 mysite.dev
# ::1 localhost
I try to access my project using this URL: http://www.mysite.dev/ BUT I am getting a Server not found error I tried accessing it using www.mysite.dev , http://mysite.dev but still having a bad luck!
My virtual host was working before but i'm not sure why it wasn't working now. Some weird stuff going on.
I am not sure what's happening. Any ideas will be greatly appreciated!
Thanks!
First you need to remove the example dummy definitions from your vhost-httpd.conf file. They are there as examples only just to get you started with the syntax, and should not remain in an active conf/extra/httpd-vhosts.conf as they are pointing to non existant folders.
So remove these 2 definitions from the file:
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot "g:/Apache24/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host2.example.com
DocumentRoot "g:/Apache24/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>
Second Apache 2.4.x is IPV4 ( 127.0.0.1 ) and IPV6 (::1) aware so your hosts file should look like this with definitions for both IPV4 and IPV6 versions for each site. The browser can arbitrarily use either so you need both but will probably use the IPV6 network in preference to the IPV4 if both are actually active on your PC.
127.0.0.1 localhost
::1 localhost
127.0.0.1 mysite.dev
::1 mysite.dev
Now on the 2 Virtual Hosts that actually exist on your system try this as the Virtual Host definition :
<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>
DocumentRoot "g:\wamp\www\mysite\public"
ServerName mysite.dev
ServerAlias www.mysite.dev
ErrorLog "logs/mysite-error.log"
CustomLog "logs/mysite-access.log" common
<Directory "G:/wamp/www/mysite/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
The <Directory>....</Directory> section within the <VirtualHost>....</VirtualHost> section tells Apache which IP Addresses it is allowed to accept connections from, so using the Apache 2.4 syntax Require local limits access so that only the PC running WAMPServer i.e. Apache can connect to any of these site.
Avoid mixing Apache 2.2 syntax and Apache 2.4 syntax together in the same definition. So dont use
Order Allow,Deny
Allow from all
and
Require all granted
in the same definition. You are using Apache 2.4 so use the Apache 2.4 syntax.
If you find you want to allow other PC's inside your local network to see you site i.e. work mate or the kids etc, you can add this syntax to one or more of your Virtual Host definition.
Allow just a single other PC into your site
Require local
Require ip 192.168.1.100
or 2 other PC's
Require local
Require ip 192.168.1.100, 192.168.1.101
Or to anyone on your local network just use the first 3 of the 4 quartiles of the ip address.
Require ip 192.168.1
Also avoid using the syntax that allows access from anywhere i.e.
Require all granted <--Apache 2.4 syntax
or
Order Allow,Deny <-- Apache 2.2 syntax
Allow from all
It may solve your issues in the short term, but is just waiting to catch you sometime later when you decide you want to show your site to a friend/client/boss. If you get to the stage of Port Forwarding you router so that the world is allowed into your network that would cause ALL OF YOUR SITES to become available to the world.
Better to change the ONE Virtual Host Definition for the ONE site you want people to see for testing/bragging from Require local to Require all granted and only allow that single site to be access from the internet.
Once you have made all these changes remember to restart Apache.
Also if you change the hosts file to make the chnages active you should either reboot or run these command from the command line of a command windows started ising the Runs as Administrator option.
net stop dnscache
net start dnscache
If you are using Windows 10 the above dns commands no longer work, you should do this instead.
ipconfig /flushdns
Due to Google acquiring .dev gTLD, having .dev development sites is no longer easily possible, best way to mitigate is to just rename your development domain into .local or something that you prefer.
What happens in the background is that the local DNS server redirects the browser to 127.0.53.53 (open cmd > nslookup yourdomain.dev) in order to inform end-users of .dev gTLD being acquired. Since the .dev domain in hosts file is set to 127.0.0.1 it shows connection refused.
You can change 127.0.0.1 to 127.0.53.53 in the hosts file and see that the browser error changes from ERR_CONNECTION_REFUSED to ERR_ICANN_NAME_COLLISION.
Following is working for me
<VirtualHost *:80>
DocumentRoot "G:\project\test.dev"
ServerAdmin test#gmail.com
ServerName test.dev
ErrorLog "logs/test.dev-error.log"
CustomLog "logs/test.dev-access.log" common
<Directory "G:\project\test.dev">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
I fix the same problem by uncomment some lines in httpd.conf in Apache folder.
Uncomment lines below:
Include conf/extra/httpd-vhosts.conf
LoadModule vhost_alias_module modules/mod_vhost_alias.so
Save file and Restart your Apache and it will work.
Many thanks to this guy:
https://john-dugan.com/wamp-vhost-setup/
I am coming very late to this question, I did all what was mentioned by #RiggsFolly but one thing I changed made it to work instantly. I changed .dev to .test as .dev is reserved. hope this helps
Check out this modules uncommented in httpd.conf
proxy_module
proxy_http_module
try this on you apache httpd.config file:
<VirtualHost *:80>
ServerName mysite.dev
DocumentRoot "g:\wamp\www\mysite\public"
SetEnv APPLICATION_ENV "development"
<Directory "g:\wamp\www\mysite\public">
DirectoryIndex index.php
Options All Includes Indexes
Options All Indexes FollowSymLinks
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
restart your wamp server and put url like mysite.dev/ on you browser.
hope it will help you.
thank you.
I'm using WAMPSERVER to run a wordpress site that has to be acessible by the users in my network, like a environment for testing together.
Localhost works fine, but at first i couldn't access the aplication from other computers in the network. I created a rule to open the port 80, created an Alias in the Apache configuration, and it worked but the theme and any images inside subfolders wouldn't load and the console was returning lots of 404 responses.
I want to map the subfolders and its files that are under the 'base dir' of the site. I tried tons of options in the Apache conf. file but i couldn't make it.
Attached a printscreen of the responses, the apache conf file and the windows hosts file
Httpd.conf :
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#animamidia
DocumentRoot "C:\wamp\www\website"
ServerName www.animamidia
ErrorLog "logs/animamidia-error.log"
CustomLog "logs/animamidia-access.log" common
<Directory "C:\wamp\www\website\*">
Options FollowSymLinks Includes
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Windows hosts file:
127.0.0.1 www.animamidia
The site with it's theme broken because the requisition returned a 404
Well i found the problem.
Even though i couldn't enter the wordpress-admin i decided to check the 'wp-config.php' file just in case something is wrong or missing.
And what i did find is that the 'Home-URL' and the 'WP-URL' were set at 'localhost/website' which means that all the requisitions would point at this location as a base directory.
All i had to do was to use the 'define' comand and set the site's URL to the machine's IP and now the environment is all set up for the guys over here to develop and test their stuff.
I have two Virtual Hosts on Redhat Enterprise server, one of which functions as desired. The second I a have problems when using PHP to do any kind of file operations. As far as I can tell both virtual hosts have been set up in the same. I have checked that file permissions have been set correctly on the folders/files in question. I have gone as far to set permissions to 777.
Can anyone suggest where I might have gone wrong? The virtual hosts are set up as follows:
<VirtualHost *:80>
ServerName intranet
ServerAlias intranet *.intranet
DocumentRoot /home/burnside/public_html
<Directory "/home/burnside/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName tracker
ServerAlias tracker *.tracker
DocumentRoot /home/tracker/public_html
<Directory "/home/tracker/public_html">
Allow from all
Options +Indexes
</Directory>
</VirtualHost>