1

I just installed apache 2.2 on windows and can't get it to react to my changes. It keeps showing the 'It works!' in the default index.html file. I've changed the DocumentRoot, < Document, and have a index.html in the new location.

DocumentRoot "C:/PersonalWebsite"
<Directory "C:/PersonalWebsite">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>

<IfModule dir_module>
   DirectoryIndex index.html
</IfModule>

I don't have any trailing slashes at the end of the URLs, and I've checked the permissions of the directory and file and it's all fine. I can change the content inside the index.html located at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs, and I can view the changes in my browser. So somehow, somewhere, it's still referring to the old path. I've also restarted the service after making the changes and it doesn't crash with the URL I've entered. I've also made sure I'm editing the correct httpd config file, through start->programs->apache->edit config file

------------EDIT--------------

Okay, so I dont have enough characters to post the full explanation I found to fix this problem, so I'll post it in here.

Okay, so I tried the above to no success. I then tried something else.

  • I've been restarting apache through the start menu->apache->control->restart, and I just tried to stop it again through the menu.
  • I then opened up my browser again and I tried to view the page again, and it worked. I checked the apache symbol in the tray, and noticed it was still running. I then stopped the service through that symbol in the tray instead of the start menu, and it changed from green-> red indicating it stopped.
  • I started it up again, and I was flashed a prompt by windows(on a non-admin user account) asking about the httpd file. I clicked okay, and went to my browser, and it worked!

So the question is the restart via the menu not a 'true' restart? and this whole time it hasn't been working is because it was still using the old httpd file? Is this a windows issue-not being an admin account or something else?

Thanks for the suggestions though!

gideon
  • 1,145
  • 2
  • 13
  • 28
Warren
  • 13
  • 1
  • 4
  • Check through your configuration for any virtual host definitions. These can have their own DocumentRoot settings. – cjc Mar 07 '12 at 03:03

1 Answers1

1

I don't think you are over riding the default website, which would be required for it to work like you describe. (my experience is with apache on Linux so you might have to translate principles across)

basically apache will have a default httpd.conf file somewhere, typically under the install folder at conf\httpd.conf this will specify all the settings such as DocumentRoot that will be used if not specified elsewhere.

I would begin by adding the following at the bottom of your httpd.conf to declare a Name VirtualHost to be used for your site;

NameVirtualHost *:80

<VirtualHost *:80>
ServerName myservername.com

 #what is your home page
 DirectoryIndex index.html 

LogLevel warn
 #    CustomLog logs/somelogfile.log
 #    ErrorLog      /var/log/httpd/someerror.lgo


DocumentRoot "C:/PersonalWebsite"
<Directory "C:/PersonalWebsite">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>

<IfModule dir_module>
   DirectoryIndex index.html
</IfModule>

</VirtualHost>

and reload apache.

Tom
  • 11,176
  • 5
  • 41
  • 63