Forum Moderators: phranque
I installed Apache server sometime ago.
I can host 2 of my own small websites now.
But I have the content of my sites in the internal hard drive.
Because I have a small 50GB internal hard drive, I would like to keep the content of my sites in my external hard drive.
Please any one let me know how I do that !
Kindly Amanda Nguyen
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com *.example.com
DocumentRoot F:/sites/example
</VirtualHost>
Where F:/sites/example is the folder in my external hard drive containing the content of my "example.com" website.
But the browser couldn't open the site
( it worked when I specified:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com *.example.com
DocumentRoot htdocs/example
</VirtualHost>
)
So what did I go wrong ?
Thank You Beforehand
Amanda Nguyen
[edited by: jdMorgan at 4:31 pm (utc) on Dec. 23, 2008]
[edit reason] No URLs, please. See Terms of Service and Forum Charter. [/edit]
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com *.example.com
DocumentRoot F:\sites\example
</VirtualHost>
It doesn't work .... The IE browser says "The website declined to show this webpage..........HTTP 403"
Amanda Nguyen
Also, either turn off "Friendly HTTP error messages" in IE options, or use a different browser -- IE "hides" your server's actual error response unless it is longer than a certain number of bytes (256 or 512 bytes, it varies), and this makes it harder to debug problems.
Jim
But then people with IE couldn't see my website ?
I tried to turn off "Friendly HTTP error messages" in IE options, I
got this message:
Forbidden
You don't have permission to access / on this server.
My friend who has Firefox browser has just tried opening the site on his Firefox browser. He got the same message:
Forbidden
You don't have permission to access / on this server.
Amanda Nguyen
Right-click on the site-storage folder on your "D" drive," select "properties" and investigate the "permissions" options. Then do this for all of the folders and files below that level as well.
Jim
I have just installed FireFox 3.0.5, actually I am using it right now.
I was trying to invest the "permissions" options:
In My Computer, right-click on the F drive (the content of my site is in F:\sites\)
Click on Sharing
Click on "If you understand the risk but still want to share the root of the drive, click here"
Put a mark in "Share this folder on the network"
Put a mark in "Allow network users to change my files"
Click on Apply
Click on OK.
Actually, there are not much to do in my Microsoft Windows XP Professional Version 2002 Service Pack 3.
I dont have luck, I received the same old error, strangely !
Amanda Nguyen
I have tried something else:
1. Right-click on the site-storage folder on my "F" drive (the "F:\sites" folder)
2. On the general tab, I uncheck the "read-only" attribute.
3. Click Apply,
4. Check the "Apply changes to this folder, subfolders and files" button.
5. Click OK
I still receive the message: "The website declined to show this webpage"
I try to right-click "F:\sites" folder again, the "read-only" attribute appears checked.
I have unchecked the "read-only" attribute over and over again, but everytime I right-click "F:\sites" folder, it still appears checked !
So strange !
Amanda Nguyen
<Directory "F:\sites">
EnableSendfile Off
</Directory>
<VirtualHost *:80>
ServerName www.example.com:80
ServerAlias example.com www.example.com
ServerAdmin webmaster@example.com
DocumentRoot "F:/sites/example"
DirectoryIndex index.html
<Directory "F:/sites/example">
Options -Indexes FollowSymLinks Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog F:/sites/example/error_logs/error.log
CustomLog F:/sites/example/access_logs/access.log combined
LogLevel info
</VirtualHost>
If by some chance this doesn't work, you can point the error logs to a directory on your computer's hard drive to help you track down the source of the problem.
Options -Indexes FollowSymLinks Includes
Mixing +/- and non +/- options is not a good idea [issues.apache.org].
[edited by: Caterham at 2:23 pm (utc) on Dec. 27, 2008]
Coopster, setting the EnableSendfile directive doesn't work for me.
Tangor, do you mean the "Network sharing and security" option on the "properties" dialog box when saying "simple file sharing" ? I have tried with that option both on and off.
Key_Master,Your bit of code works for me, I use this:
<VirtualHost *:80>
ServerName www.example.com:80
ServerAlias example.com www.example.com
ServerAdmin example@example.com
DocumentRoot "F:/sites/example"
DirectoryIndex index.php
<Directory "F:/sites/example">
Options -Indexes +FollowSymLinks +Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog F:/sites/example/error_logs/error.log
CustomLog F:/sites/example/access_logs/access.log combined
LogLevel info
</VirtualHost> May I ask: do I need an existing email in the above code ?
Caterham and Jim
Both "Options -Indexes +FollowSymLinks +Includes" and "Options -Indexes FollowSymLinks Includes" work for me
Does it mean that I have no options currently in effect in In HTTPD.CONF ?
Well, thank you very much all who helped me. Without you this would not have been possible. I hope you all had a very Merry Christmas and best wishes for the year ahead. My computer HD was small indeed and to have it on my external drive is of great benefit.
Again , thank you so very much !
Your friend , Amanda Nguyen.
Glad you got it working!
As for Options, read the documentation of the Options directive in the Apache 'core' documentation, paying attention to the effect of prepending "+" or "-" to the various options; I doubt that I can explain it better than the people who wrote the code, so the Apache docs are your best source for information.
Jim
As for the bug mentioned above, I tried to force it to happen with Apache 2.2.8 and 2.2.11 (latest release) but I couldn't. Nonetheless, it is would be good practice to include the + sign to any enabled options (no matter how stupid that may seem). It would also help a lot if Apache didn't release updates with a default httpd.conf file that also doesn't include the + to enabled options.
And one more thing I thought I'd mention, from httpd.conf:
# NOTE: Where filenames are specified, you must use forward slashes
# instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
# If a drive letter is omitted, the drive on which httpd.exe is located
# will be used by default. It is recommended that you always supply
# an explicit drive letter in absolute paths to avoid confusion.
May I ask: do I need an existing email in the above code ?
That's up to you: ServerAdmin [httpd.apache.org]