How to change default folder from htdocs BUT keep Admin

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 23. February 2011 22:01

Hi I can change the default folder from htdocs to elsewhere (e.g. D:\Website) but this then stops the "Admin..." button working in the Xampp control panel. How can I restore the functionality of that button or at the very least get to the Xampp admin page so I can access PHPMyAdmin and other things? Thanks!
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby WilliL » 24. February 2011 11:16

you ca local keep "localhost" and create a vhost on another location.
http://httpd.apache.org/docs/2.0/en/vhosts/ read it carefully :wink:
or use forum search "vhost", there are a lot more hints
Willi
WilliL
 
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 24. February 2011 18:01

Okay, sorry if this is something that should be obvious but this is my first time running Xampp or any of its components.

I followed the guide and typed the following into httpd.conf but then Apache does not start.

NameVirtualHost

<VirtualHost>
ServerName localhost1
ServerAlias localhost1 *.localhost1
DocumentRoot D:/Applications/Xampp/htdocs
</VirtualHost>

<VirtualHost>
ServerName localhost2
DocumentRoot D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache
</VirtualHost>

This is so frustrating! :evil: Last time I got this far with website design and then gave up after I hit a brick wall with Xampp!
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby WilliL » 24. February 2011 19:09

undo your changes in httpd.conf

use xampp_folder/apache/conf/extra/httpd-vhosts.conf it is included by httpd.conf
it includes an excample!!

1st <VirtualHost *:80> container should be "localhost"

[url]http://community.apachefriends.org/f/search.php?keywords=%3CVirtualhost&terms=all&author=&fid[]=16&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Suche[/url]
Willi
WilliL
 
Posts: 661
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 24. February 2011 22:32

Thanks, so am I looking to code something like (without the #s):

##<localhost>
##ServerAdmin postmaster@dummy-host.localhost <-- DELETE
##DocumentRoot "D:/Applications/Xampp/htdocs/"
##ServerName localhost
##ServerAlias localhost
##ErrorLog "logs/dummy-host.localhost-error.log" <-- DELETE
##CustomLog "logs/dummy-host.localhost-access.log" combined <-- DELETE
##</localhost>

##<otherhost>
##ServerAdmin postmaster@dummy-host2.localhost <-- DELETE
##DocumentRoot "D:/My Documents/Merlin/Creative/Etc"
##ServerName otherhost
##ServerAlias otherhost
##ErrorLog "logs/dummy-host2.localhost-error.log" <-- DELETE
##CustomLog "logs/dummy-host2.localhost-access.log" combined <-- DELETE
##</otherhost>
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby Sharley » 24. February 2011 22:40

User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 24. February 2011 22:56

Thank you Sharley, so I understand I have to put this in the httpd-vhosts.conf file, not the httpd.conf file. Do I move httpd-vhosts.conf from the "extra" folder to main or leave in the "extra" folder?

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/applications/xampp/htdocs"
<Directory "D:/applications/xampp/htdocs" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName website.com
ServerAlias http://www.website.com
DocumentRoot "D:/My Documents/Website"
ServerAdmin serveradmin@website.com
<Directory "D:/My Documents/Website" >
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "D:/xampp/htdocs/website/cgi-bin/"
CustomLog domlogs/website_access.log combined
ErrorLog domlogs/website_error.log
LogLevel error
</VirtualHost>

And I need to create the "domlogs" folder in xampp. Hopefully the above will work! The intention is to be able to access my website locally in the browser and still use the Apache "Admin" panel!
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby Sharley » 24. February 2011 23:08

Deathwing wrote:...Do I move httpd-vhosts.conf from the "extra" folder to main or leave in the "extra" folder?
No, leave it where it is because in the httpd.conf file, which apache reads first is a couple of lines that tell it where to look for vhosts configuration file.
Code: Select all
# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"
99.99% of the time you should keep the httpd.conf file at the default settings they were at when you installed XAMPP and only change settings in the conf files in the extra folder.

Don't forget to add any vhost server names to the Windows HOSTS file.
You should have these entries based on your posted configuration as the first entries in the HOSTS file if you are accessing website.com only from your PC but no need to include 127.0.0.1 website.com if your access will only be from the Internet
Code: Select all
127.0.0.1 localhost
127.0.0.1 website.com
Experiment with this and see what best suits.

Do not include the http:// in the ServerAlias directive.
Code: Select all
ServerAlias www.website.com


You will also need to create the domlogs folder in the xampp\apache folder or your configuration will error - see my last post in the link I gave you.
viewtopic.php?p=174600#p174600
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 28. February 2011 12:28

Thanks I appreciate the help. The site I was designing has the working title fairy kingdoms so I used that name in the code, as below. My httpd-vhosts file (in Apache/conf/extra folder) reads:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/applications/xampp/htdocs"
<Directory "D:/applications/xampp/htdocs" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName fairykingdoms.com
ServerAlias www.fairykingdoms.com
DocumentRoot "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache/"
ServerAdmin serveradmin@fairykingdoms.com
<Directory "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache/">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "D:/xampp/htdocs/website/cgi-bin/"
CustomLog domlogs/website_access.log combined
ErrorLog domlogs/website_error.log
LogLevel error
</VirtualHost>

I created Apache/domlogs folder then went to Windows/System32/drivers/etc and edited hosts file to read:

127.0.0.1 localhost
127.0.0.1 fairykingdoms.com

I then ran Xampp but had the same issue - Admin is greyed out, and the Apache service does not seem to want to start. Any ideas where I might have gone wrong? I am accessing from local PC only.
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby Sharley » 01. March 2011 00:48

Remember that if you have a soft error in your vhosts file that the default, first vhost, will be served.
If the error relates to an incorrect or non existent path then Apache can't start.

Apache has tunnel vision and can't think 'out of the box' so tell Apache exactly where every thing is located and make sure that the name's case is also correct - no room at all for errors here.

So you have an error in your vhost configuration.

You have told Apache in the first vhost (localhost) that XAMPP is located here:
D:/applications/xampp/

In your second vhost (fairykingdoms) you have told Apache that XAMPP is located here:
D:/xampp/
Code: Select all
ScriptAlias /cgi-bin/ "D:/xampp/htdocs/website/cgi-bin/"
change this after adding a cgi-bin folder in your fairykingdom DocumentRoot folder
Code: Select all
ScriptAlias /cgi-bin/ "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache/cgi-bin/"
Drop the forward slash after the Apache folder in both the DocumentRoot and the Directory directives but leave it in place after the cgi-bin folder name.

Remember also that Apache and most things in XAMPP are case sensitive unlike in Windows where case is not important.


Always check the \xampp\apache\logs\error.log file when apache can't start.

To check the syntax of your vhost file open a command prompt in the \xampp\apache\bin folder (cd to the folder) and issue this case sensitive command:
apache -S
Copy and paste the result by using the Edit menu item in the console window.

I have tried to correct what I see and pasted it here with comments
NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/applications/xampp/htdocs" <- should be the same as in your httpd.conf file
<Directory "D:/applications/xampp/htdocs" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName fairykingdoms.com
ServerAlias http://www.fairykingdoms.com
DocumentRoot "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache" <-No slash
ServerAdmin serveradmin@fairykingdoms.com
<Directory "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache"> <-No slash
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache/cgi-bin/" <-Create this folder in here and keep the slash
CustomLog domlogs/website_access.log combined
ErrorLog domlogs/website_error.log
LogLevel error
</VirtualHost>
It is also normal practice when working at localhost level to empty your browser's cache (Temporary Internet Files) very often especially if you think that you have an unexplainable issue appear.

Good luck and fingers crossed for a positive outcome that let's you move forward with minimal hair loss. :D
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 24. March 2011 12:52

Hi sorry I have not been online for a while, had some emergency family issues that had to be sorted, so hope you are still here Sharley because you've been very helpful so far!

My httpd-vhosts now reads:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/applications/xampp/htdocs"
<Directory "D:/applications/xampp/htdocs" >
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName fairykingdoms.com
ServerAlias www.fairykingdoms.com
DocumentRoot "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache"
ServerAdmin serveradmin@fairykingdoms.com
<Directory "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache">
Options Indexes +FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "D:/My Documents/Merlin/Creative/Fairy Kingdoms/Apache/cgi-bin/"
CustomLog domlogs/website_access.log combined
ErrorLog domlogs/website_error.log
LogLevel error
</VirtualHost>

The httpd.conf xampp address is "D:/applications/xampp/htdocs"

Win32/drivers/etc hosts.txt reads:

127.0.0.1 localhost
127.0.0.1 fairykingdoms.com

Xampp still won't start up Apache or mySQL. I went to D:\applications/xampp/apache/bin in command prompt and typed "apache -S" (with that capitalisation and without quotation marks) and it says " 'apache' is not recognised as an internal or external command, operable program or batch file."

Hair loss is starting! :)
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30

Re: How to change default folder from htdocs BUT keep Admin

Postby Sharley » 24. March 2011 23:54

1. Look in the \xampp\apache\logs\error.log file for clues why Apache can't start.

2. Type at the command prompt in the apache\bin folder httpd.exe -S
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How to change default folder from htdocs BUT keep Admin

Postby Deathwing » 25. March 2011 01:23

I went to D:/applications/xampp/apache/bin in command prompt and typed "apache -S" (with that capitalisation and without quotation marks) and it says " 'apache' is not recognised as an internal or external command, operable program or batch file."

The log file doesn't seem to have any entries for today? It just has entries from last month.

Apache says "Apache started" but then localhost/index.html (correct filename) does not find the page, and the admin button is still greyed out?
Deathwing
 
Posts: 7
Joined: 23. February 2011 21:30


Return to XAMPP for Windows

Who is online

Users browsing this forum: ben.mansuk and 57 guests