Thread: Setting up Apachi on Windows 7 64 bit

Page 1 of 2 12 Last
1. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12

Setting up Apachi on Windows 7 64 bit

I am trying to setup Apachi on the above platform. I am using apache_2.0.63-win32-x86-no_ssl.msi and I I have installed it into E:\Apache Group\Apache2. I have a folder htdocs and this appears to have installed correctly according to http://localhost

I have looked in htdocs but can't find the html file. There is a index.html.en this does not look the same the apache_pb.gif does not get displayed. Is this html in another location?

Can't find an error log in E:\xampp

Is there a configuration file that shows paths and files that can be edited. Change the default location
Last edited by Otuatail; October 22nd, 2013 at 02:16 PM.
2. - Looks like your htdocs uses content negotation. Blah blah blah the "index" file is probably index.html.en but there may be other files also being used.
- You can edit whatever you want to edit, provided you know what you're editing. You can trash everything there if you want, but a better approach is to just change the directory where the "website" is based in.
- The configuration file you're looking for is probably httpd.conf or apache(2).conf.

If you're not sure of yourself and will be using PHP, I recommend installing WampServer or XAMPP instead: they're complete packages that take care of most of the configuration stuff for you.
3. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
Ok Thanks. I have located httpd.conf & httpd.default.conf

These files allow you to change the location of the files. What I can't understand is there should be a default file name. On my website it is index.php or index.html. I would want to change the default to this.

Not sure what WampServer or XAMPP are but what I want to do is install MySQL and PHP5
4. DirectoryIndex
Code:
DirectoryIndex index.php index.html
You'd put that in the <VirtualHost> configuration for your site (be that the default site or a new one you make).

Unless you're interested in the nitty gritty details of setting up Apache and installing PHP and MySQL, I strongly recommend WampServer or XAMPP.
5. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
Hi thanks for your help. I have installed xampp

I now have E:\xampp\htdocs\xampp\splash.php

Can I change the default name to index.php and in a better folder place.
6. I suggest you leave that htdocs directory alone and make a new one for your stuff. Then make a new VirtualHost for it (good) or change the existing, default host to point to the new directory instead (not as good).
7. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
I would rather create my own htdocs directory and change the config. How do I do that?
8. 1. Pick a domain name for the website. Not something that looks like a normal name (*.com or *.net) but something that's obviously not a real website. I personally use *.local, so like "otuatail.local".

2. Find your Windows hosts file (C:\Windows\System32\drivers\etc\hosts), right-click, Properties, and make sure it's not read-only.
On Vista and later, find your editing program, right-click, and Run as Administrator. (For XP just run it normally.) Then open the hosts file and add
Code:
127.0.0.1 whatever-domain-name
Save and exit.

3. Find the E:\xampp\apache\conf\extra\httpd-vhosts.conf file and add
Code:
NameVirtualHost * (if this isn't in there already)
<VirtualHost *>
ServerName domain-name-for-the-new-site
DocumentRoot "path\to\your\new\directory"

<Directory "same path as above">
# allow access by default
Order deny,allow
</Directory>
</VirtualHost>
Save and restart Apache.

4. Put a simple index.html in the directory with something so you'll know if it's working. Then try going to http://whatever-domain-name and see what happens.
9. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
I have changed both these files and these are the changes made

host file

# localhost name resolution is handled within DNS itself.
127.0.0.1 otuatail.local
# ::1 localhost

httpd-vhhosts

NameVirtualHost * (if this isn't in there already)
<VirtualHost *>
ServerName webmaster@otuatail.local
DocumentRoot "E:/xampp/htdocs/otuatail.local"

<Directory "E:/xampp/htdocs/otuatail.local">
# allow access by default
Order deny,allow
</Directory>

However none of these work in any browser

http:\\otuatail.local
http:\\otuatail.localindex.html
http:\\localhost

www.otuatail.local
www.otuatail.localindex.html
www.localhost

P.S. I did re-boot the pc just in case. Also should there be a default file name loke index.php or html?
10. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
I have also tried 127.0.0.1 this does not work and just for the fun of it I added this entry into hosts

62.24.150.2 microsoft.com

This IP is talktalk.co.uk not Microsoft. Surly I should have got the wrong website!
11. Originally Posted by Otuatail
NameVirtualHost * (if this isn't in there already)
You weren't actually supposed to put that stuff in the parentheses into the configuration file.

Originally Posted by Otuatail
ServerName webmaster@otuatail.local
That's an email address. It's supposed to be a domain name.

You're also missing a </VirtualHost>, as far as I can tell.

Reading Apache's error log would have told you about all those problems.

Originally Posted by Otuatail
However none of these work in any browser

www.otuatail.local
www.otuatail.localindex.html
www.localhost
Those won't work unless you put www.otuatail.local and www.localhost into your hosts file as well.
12. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
I was copying what was above in the samples. They show an email address. The entire contents of both files are

hosts
Code:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
127.0.0.1	otuatail.co.uk
#	::1             localhost
-----
AND httpd-vhosts.conf
Code:
# 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.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# 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>
##DocumentRoot "E:/xampp/htdocs/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>
##DocumentRoot "E:/xampp/htdocs/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 *>
ServerName www.otuatail.co.uk
DocumentRoot "www.otuatail.co.uk"

<Directory "E:/xampp/htdocs/otuatail.co.uk">
# allow access by default
Order deny,allow
</Directory>
</VirtualHost>

NameVirtualHost * (if this isn't in there already)

And there should be an entry for the default web page name somewhere. requinix supplied
<VirtualHost *>
not
<VirtualHost *:80>
Last edited by requinix; October 24th, 2013 at 12:52 PM. Reason: added code tags
13. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
This is still an issue. I have supplied the full contents of the host config and the xampp config. Is this correct?
14. Well, your hosts file has otuatail.co.uk instead of the otuatail.local you mentioned, but I assume that's because you're just using a different name for the domain. (I strongly suggest you not use the name of an actual website, for one in case you want to visit the real website.)

Your VirtualHost only defines www.otuatail.co.uk however. You need both the www and non-www versions, with one being an "alias" of the other.
Code:
ServerName www.otuatail.co.uk
ServerAlias otuatail.co.uk
You also need both versions in your hosts file - the "www" is neither implied nor automatic when it comes to DNS.
Code:
127.0.0.1 www.otuatail.co.uk
127.0.0.1 otuatail.co.uk
15. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Dec 2003
Posts
139
Rep Power
12
Hi Thanks for this. I have added the changes. www.otuatail.co.uk is not a real website. I want a virtual website on my PC so that I can develop the software.

Do I need to re-boot the PC every time I make changes to the host file or the xampp config like you sometimes have to do in windows.

I should be able to type in
http://localhost/, 27.0.0.1, www.otuatail.co.uk

To get to this virtual site. were is it and how do I put up a simple home page?

If I could JUST get to this point I would be happy
Page 1 of 2 12 Last