Apache Web-Serving with Mac OS X, Part 4
Pages: 1, 2
Changing Your Configuration With .htaccess Files
As you've run through these various tweaks and twiddles of the Apache
configuration file, one thing has always remained true: to make the
changes active, you've had to stop and start Apache after each edit. Not
only is this tedious and subject to forgetfulness, it's also avoidable with a little
thing called an .htaccess file.
The .htaccess file, when enabled, allows you to control and override
a large portion of the Apache configuration without having to stop and
start after every change. Once you've instructed Apache to enable
.htaccess control, you no longer have to be a privileged user (like an
Administrator) to enact changes.
Think of .htaccess files as user-modifiable Apache configurations
that only affect the directories in which they reside. Let's search through
our Apache configuration file and see what we find. Our first result for
.htaccess is actually a comment:
# This controls which options the .htaccess files
# in directories can override. Can also be "All",
# or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit".
AllowOverride None
By now, this should be old hat to you -- this "AllowOverride" directive is contained within the <Directory> block we've been messing with for the main GatesMcFarlaneCo intranet.
Since .htaccess files can override a large portion of the
Apache Webserver configuration, they're incredibly powerful, but also
dangerous. A foolhardy user could easily disable or misconfigure parts
of their site due to an incorrect directive. As such, .htaccess files have
different levels of control. One of these levels is "None" -- in other
words, .htaccess files have no control over any part of the Apache
configuration. They're simply ignored. You can find more information
about the different levels of control in the AllowOverride
documentation at the Apache site.
For now, change the AllowOverride line to:
AllowOverride All
This allows us to override everything available to us within our
.htaccess file. In this case, we're changing the AllowOverride line for
the /Library/WebServer/Documents directory. If you're looking to
give your user directory .htaccess control, be forewarned -- it's not as
perfect as you'd expect. You can turn on the .htaccess feature simply
enough, but some directives that rely on Apache's DocumentRoot, like
ErrorDocument, will fail. Sometimes, you can cheat -- in the case of
ErrorDocument, you can refer to a URL instead of a local file.
For one final time, stop and start the Apache Webserver. Now what?
.htaccess files are plain text files, placed in the directory in which you
want them to be active. We're going to create a quick and dirty
example now, so open up a text editor and save an empty .htaccess
file into the /Library/WebServer/Documents directory. After you've done
that, take a look at the example .htaccess file below, which has been
commented for the sake of your childlike innocence:
# override the ErrorDocument defined in our
# main Apache configuration file. use "404.html"
# instead. if this .htaccess file is going to be
# active under a user directory, this line will
# need to be modified to something like (replaced
# with your real domain/IP and username, of course):
# ErrorDocument 404 http://domain.or.ip/~user/404.html
ErrorDocument 404 /oops-404.shtml
# hey, someone typo'd our contact page, so we'll
# permanently redirect "contct.html" to the correct
# filename, "contact.html". if using this under a
# user directory, modify to "/~user/contct.html",
# and be sure to tweak the URL appropriately.
Redirect /contct.html http://localhost/contact.html
# RedirectMatch's are useful to do mass redirections
# based on certain match criteria. in this
# example, we're redirecting ALL .html files in
# this directory to .shtml files with matching names.
# .htaccess files are read from top to bottom, so if
# someone mistypes "contct.html", they'll be redirected
# to contact.html with the above line, and then
# redirected to contact.shtml with this line.
RedirectMatch (.*)\.html$ $1.shtml
As mentioned, you can use most directives that you've learned throughout this series. For example, if you wanted to turn on SSI, stop Apache from autogenerating indexes, and block access to only people from oreilly.com, you could add the following:
Options Includes -Indexes
Order deny,allow
Deny from all
Allow from oreilly.com
.htaccess files apply to the current directory, and all subdirectories, as
long as none of the subdirectories have their own .htaccess file. If a subdirectory does have one, the contents of that .htaccess file are used instead.
Password Authentication
One of the most common uses of .htaccess files is password-protecting
a directory. When protected directories are accessed, a visitor's browser will
prompt for a username and password. If the visitor authenticates
correctly, they're allowed in -- if not, an error 401 is triggered, and
the visitor is denied.
So yes, Dan from Marketing, we did get your email (and its annoying and frequent follow-ups), and yes, we're going to password protect the "super secret ad campaign" directory you've been working oh-so-hard on (snicker, snicker, reese's pieces).
To start the process, we're first going to create the user database. This database will contain all the usernames and passwords that will be authenticated against -- they're not keyed to any specific directory, so you could use one database for three hundred users spread across two dozen directories. To create the database, get into your Terminal, and gaze blurry eyed at the command below:
htpasswd -c /Library/WebServer/.htpasswd dan
It's nice and innocent, right? htpasswd is the name of the utility
that creates and modifies this user database of ours. The -c flag says
"if this database doesn't exist, create it." /Library/WebServer/.htpasswd
is the full path to our database file, and you'll want to take special notice
that it's outside Apache's DocumentRoot (which, in OS
X, is defined as /Library/WebServer/Documents). Sticking the file
outside the DocumentRoot ensures that no one can view this database from
the Web. Finally, dan is the user that you want to add to the
database. An output of this command is below:
htpasswd -c /Library/WebServer/.htpasswd dan
New password: ********
Re-type new password: ********
Adding password for user dan
You'll want to make sure that when you add new users to an
existing database file that you do not
use the -c flag. Doing so will overwrite your existing file with a brand
new one. Not so good, bub. Adding a user is a simple matter (note the
lack of the -c flag):
htpasswd /Library/WebServer/.htpasswd mishka
New password: *********
Re-type new password: *********
Adding password for user mishka
If you look at /Library/WebServer/.htpasswd, you'll see the added
users:
less /Library/WebServer/.htpasswd
dan:Vcv7xTIIW6g7U
mishka:3c4T6IdfWweU
Next, it's really just a matter of telling Apache what directory we
want to secure. Open (or create) your .htaccess file, and add the
following:
AuthName "Uber Goober Ad Campaign"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user
|
Previously in the Series
Apache Web-Serving with Mac OS X: Part 1 Apache Web-Serving with Mac OS X: Part 2 |
AuthName will be shown as the title or description of the password
box that a visitor's browser will show, and in Apache lingo, this is called a
"realm". AuthType is set to the standard "Basic" authentication (a
"Digest" authentication exists, but is outside the scope of this
article). AuthUserFile should be self-explanatory.
The require line affords some discussion. With it, you can tell
Apache to allow any user in the AuthUserFile access (as we've done
above), or you can tell Apache to allow only certain people. In the
example below, only the users "dan" and "mishka" can authenticate to
realms with the name "Uber Goober Ad Campaign." Any other users in the
AuthUserFile will be denied:
require user dan mishka
Users can also be defined by groups -- for example, you could place "dan," "mishka," and "morbus" into a group called "Marketing," and "themadman," "ashcraft," and "sprocket" into a group called "Design." From there, you could restrict access by group instead of username. For these configurations and more about Digest authentication, refer to Apache's Authentication, Authorization, and Access Control docs.
Tomcat and Secure Servers
Some of the smarmier developers at GatesMcFarlaneCo (Matt and Jeff, particularly) are fans of Java servlets secured with SSL technology. I could cover those here, but Apple has already released some rather good articles on the subject over at their Internet Developer site. I heartily recommend you check out "Using mod_ssl", and "Java and Tomcat" (parts I and II).
Conclusion
A lot of rather nifty things can be done with a stock Apache install,
and we've only touched on a few of the more common features above. We
haven't played with how to modify the appearance of Apache's
auto-indexes, how to use the mod_speling module to duplicate our
spelling Redirect, or even how to set up fake VirtualHosts to more
adequately mimic ISP environments.
Yet, we must move on. As we look at the list of requests for the GatesMcFarlaneCo intranet, only two or three remain, and they all involve something spooky called a "database." What is this monstrosity? What's EssQueueEll? Juan es muy guapo [1]. How do I install it, and even worse, what do I do upon success? Find out in part five of our Web Serving trilogy, available a few scant days after you start sweating with impatience.
Kevin Hemenway is the coauthor of Mac OS X Hacks, author of Spidering Hacks, and the alter ego of the pervasively strange Morbus Iff, creator of disobey.com, which bills itself as "content for the discontented."
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 106 of 106.
-
Thank you so much!
2004-11-26 19:41:59 FannofAimeeMann [Reply | View]
I am so glad that I can finally have a fully functional website (even with php!!!!) without having to deal with paying for this and that. You guys rock!
-
New Error 403 message not working
2004-11-06 16:32:18 r2ina2 [Reply | View]
I have my site configured to all traffic from only a couple IP addresses. I would like to generate a custom 403 message for other IPs trying to get to the site. But now the other IPs get a forbidden message along with a note that an additional forbidden error was generated trying to get the custom 403 message. I've checked priveleges on the custom message. Does it have to do with the custom message also being forbidden because it is document root? How do I set this up -- do I have to configure things with .htaccess rather than globally with httpd.conf? Thanks for any help!
-
installation instructions are convoluted
2004-08-31 08:22:33 svnguy [Reply | View]
"Because you are using Apache to provide access to the repository, you'll need to create HTTP/Apache user accounts to determine repository access restrictions and ownership of file revisions in the repository."
HOW????!!!!
Poor organization. Don't make a statement like this and not explain it immediately.
-
Wow!!
2003-12-27 13:06:37 anonymous2 [Reply | View]
Thanks! This article was GREAT! I really liked it, and now I can please some people with password protection!
-
thanks kevin
2003-11-09 12:54:35 anonymous2 [Reply | View]
nice and interesting article :-)
micha from hamburg/germany
-
user/conf file goof
2003-09-21 12:56:22 anonymous2 [Reply | View]
Just a note to anyone else who may be frustrated with changes to the user conf file not having any apparent effect.
I was experimenting with my conf file but before I did so I made a copy of it with an extension of .bak. I was attempting to remove the Indexes option but an auto generated index was still showing up. I finally figured it out by looking at the http/errors_log file and saw that right after if was reading my regular conf file it was reading the .bak file as well! So, any changes I made to the original conf file were negated by the backup file.
-
Finally a tutorial that works!
2003-09-19 21:56:43 anonymous2 [Reply | View]
Thanks! I just used your tutorial to add passwords to my web folders and to make a custom 404 page. I'll be looking for the book.
D Sawatzky
Winnipeg Manitoba Canada
-
.htaccess and cgi-bin
2003-09-17 20:46:47 anonymous2 [Reply | View]
Following you tutorial I enabled .htaccess files (AllowOverride All); I then proceeded to write the following in in my .htaccess file:
RewriteEngine on
RewriteRule ^blogs/?(.*)$ /cgi-bin/blosxom.cgi/$1
the rules appears to work, but now I am forbidden to access /cgi-bin. when i take the .htaccess file out, scripts in my cgi-bin work fine. the rewrite rule appears to work as well as the forbidden message is "You don't have permission to access/cgi-bin/blosxom.cgi/ on this server" when I attempt to go to /blogs.
Any ideas how this .htaccess rule blocked cgi-bin access?
-
Can't get custom 404 messge to work
2003-07-30 08:43:19 anonymous2 [Reply | View]
I uncommened the line # ErrorDocument 404/missing.html and restarted apache.
Now when I go to a document that should give me a 404, I get
"The requested URL /~username/dd was not found on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache/1.3.27 Server at keng4.local Port 80"
Where am I supposed to put the custom ErrorDocument? I't in the "Sites" folder of my local user.
-
What am I doing wrong?
2003-07-23 15:10:13 ricosalomar [Reply | View]
mKay, I got a .htaccess file:
AuthName "PW_auth"
AuthType Basic
AuthUserFile /Users/ratchet/accessconfig
Require user ratchet
In the directory:
[RLPB:~/Sites/pp_pw]
and access config is where it's supposed to be, and says:
ratchet:wojr6ygu/mjok.
But when I type <http://127.0.0.1/~ratchet/pp_pw/pw.php> in my browser, I get no password prompt.
I'm an idiot, who takes pity upon me?
thanks
r
-
Problems creating my own .htaccess
2003-05-18 12:08:42 mymacworld [Reply | View]
Hello Everyone:
I am really lost here. I am not the brightest person but I will try to explain my situation.
I have a directory called "test" within my /Library/WebServer/Documents directory that I would like to protect. I cd'd to my "test" directory and created my .htaccess file which consists of the following:
AuthName "REALM of MyMACwold"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user
I then typed "htpasswd -c /Library/WebServer/.htpasswd test and got
New password:
Re-type new password:
Adding password for user test
password is test and username is test. When I go to the website, I don't get a password box prompting me for the username and password. I don't understand what I did wrong? Any help would greatly be appreciated. Thank you.
Mark
-
Message 403 Forbidden and no authentication.
2003-05-09 02:55:36 anonymous2 [Reply | View]
Message 403 Forbidden and no authentication.
I believe I have followed this article to a T. I have set up my .htaccess file exactly as like this:
AuthName "TEST PAGE"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require user brad john (I have also tried require valid-user)
it is nested inside /Library/WebServer/Documents/test
test is a folder I created to test whether this would work inside test is a html file called test.html.
I have changed the httpd.conf file in /etc/httpd so that the AllowOverride to read:
AllowOverride All
I placed my .htpasswd file inside /Library/WebServer/
the .htpasswd file lists john and brad and their encrypted passwords. I checked to see if the auth_module was set to load and it is.
So with all this i get a message saying:
Forbidden
You don't have permission to access /test/test.html on this server and no authentication box will drop down. If i remove the .htaccess file from /Library/WebServer/Documents/test I have no problem accessing the test.html page.
So what do I have going wrong here is it a file permissions problem any help would be greatly appreciated. Oh it is worth mentioning that I am running OS X 10.2.5 (I really hope that apple didn't disable some part of Apache so you have to go and get X Server)
-
hwo to use cgi-bin folder outside the shared folder ?
2003-05-03 04:46:07 anonymous2 [Reply | View]
Hi,
i'm sharing with patrick.conf a folder inside my Sites folder. When i put in a cgi-bin folder, it works perfectly, but when i try to put this cgi-bin folder outside my shared folder i have a 404 error.
exemple : /Users/patrick/Sites/sitetest/ is an alias.
/Users/patrick/Sites/sitetest/cgi-bin/ works, but
/Users/patrick/Sites/cgi-bin/ doesn't.
My conf is :
<Directory "/Users/patrick/Sites/">
Options Includes MultiViews Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /~patrick/ "/Users/patrick/Sites/sitetest/"
ScriptAlias /~patrick/cgi-bin/ "/Users/patrick/Sites/cgi-bin/"
So how can i do not to share the cgi-bin folder ? it's exactly like the httpd.conf : /Library/webserver/Document/is shared but the cgi-bin are in /Library/webserver/CGI-Executable/
thanks
-
user conf, subfolder, cgi and 404
2003-05-02 16:26:41 anonymous2 [Reply | View]
Hi, i follow this wonderful tutorial, and edited mu user httpd.conf. i would like to share only the folder "sitetest" inside my "Site" folder when accessing to http://27.0.0.1/~patrick, so i wrote :
<Directory "/Users/patrick/Sites/">
Options Includes MultiViews Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /~patrick/ "/Users/patrick/Site/sitetest"
ScriptAlias /~patrick/cgi-bin/ "/Users/patrick/Sites/cgi-bin/"
but i have a 404 error.
As you can see i would like to have a cgi-bin folder at the same level of my sitetest folder so it's more secure.
Do you have any clue about this 404 error ? and how can i do to realize my cgi-bin stuff ?
(of course sitetest is chmod 755)
Thanks !
-
userc conf and subfolder
2003-05-02 16:15:11 anonymous2 [Reply | View]
Hi, i follow this wonderful tutorial, and edited mu user httpd.conf. i would like to share only the folder "sitetest" inside my "Site" folder so i wrote :
<Directory "/Users/patrick/Sites/">
Options Includes MultiViews Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Alias /~patrick/ "/Users/patrick/Site/sitetest"
ScriptAlias /~patrick/cgi-bin/ "/Users/patrick/Sites/cgi-bin/"
but i have a 404 error.
As you can see i would like to have a cgi-bin folder at the same level of my sitetest folder so it's more secure.
Do you have any clue about this 404 error ? and how can i do to realize my cgi-bin stuff ?
(of course sitetest is chmod 755)
Thanks !
-
log out?
2003-05-02 05:12:17 anonymous2 [Reply | View]
I got everything pretty much working now...
I configured Apache now so that only me and a friend of mine can log in with username and password.
Now I was just wondering how I could make a log out thing... =))
Probably I have to do it with html on the site itself...but I'm kind of a newbie so...I have no idea to be honest how to start doing that.
If anybody can answer it...tnx! =)
Later.
-
conf file mods not working
2003-01-20 15:37:55 anonymous2 [Reply | View]
Tried everything in the articles and read through all the comments-index.php just shows the text of the page.
Just get this in the log.:
[Mon Jan 20 22:36:44 2003] [notice] Apache/1.3.27 (Darwin) PHP/4.1.2 configured -- resuming normal operations
[Mon Jan 20 22:36:44 2003] [notice] Accept mutex: flock (Default: flock)
My Linux box install of php worked perfectly-shame the mac one which should be easier doesn't work!!
-
.htaccess or Virtual Host, not both
2002-11-13 11:40:06 epaul [Reply | View]
I am running Virtual Hosts in order to serve an number of webdomains. I want to use .htaccess to limit access to certain areas of some sites. If I comment out the Virtual Hosts in httpd.conf then I get the login request, so I believe that .htaccess and .htpasswd are configured correctly. With the Virtual Hosts active I do not ever see the login request. I have tried placing .htaccess in different directories, placing the Auth* information directly in the httpd.conf file in the main <Directory> file just before AllowOverride All. The error log is silent on the subject.
-
virtual directories
2002-11-11 13:42:15 anonymous2 [Reply | View]
Great articles, thanks so much. I had purchased the Apache Definite Guide, but was not able to get my OS X web server configured to parse shtml files. With your help I not only configured it to parse shtml but also set up PHP and mysql. Just one question, how do I go about creating virtual directories?
thanks,
Brigitte
-
Authorization??? .htaccess
2002-11-08 14:57:18 anonymous2 [Reply | View]
I keep getting a 401 Authorization Required error when I enter my various usernames and passwords.
I read on another website about needing to set autorization overrides in the access.conf file, could that be my problem?
" access.conf file allows user authentication to be set up in a .htaccess file. This is controlled by the AuthConfig override."
thanks,
ijohn.
-
Jaguar Server changes
2002-10-17 18:19:33 anonymous2 [Reply | View]
Jaguar server seems to have changed where virtual hosts are located. How can I set a particular domain to allow override via htaccess files?
Are there any other changes made as far as setting up the password file?
Thanks!
-
What about Virtual Hosts?
2002-09-18 11:20:16 tatlar [Reply | View]
Kevin,
Love the articles! They have helped me no end.
However, I would really like to see some info on setting up Virtual Hosts - I have tried to do this already, but without success, and have had to shelf the project and put up with the error messages I am getting! Apple's OS X Server help pages are useless, and I like your style.
Any chance of some tips???
Keep up the good work,
- Tatlar
-
Setting up an alias to an external drive.
2002-08-31 11:31:29 bradstanley [Reply | View]
I would like to have the contents of an external firewire drive available through my OS X Web sharing server. Unfortunately I cannot figure out the path. Please see the question marks bellow.
Alias /files "/???/externalDrive/files"
<Directory "/???/externalDrive/folder">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
-
Using an alias for index.html
2002-07-13 11:07:24 sacerdos [Reply | View]
I have a large site I created with GoLive. I would like to have Apache serve the site using an index.html document that would allow me to avoid restructuring the site. Using an alias, placed in /Library/Webserver/Documents, for the default index document would seem to be a way to do this, but my browser only draws a blank page.
Comments in the conf file indicate that aliases can be used to point to other locations. What am I missing?
-
Unprotecting a subdirectory
2002-06-20 05:47:16 dannes@mac.com [Reply | View]
I want to have accesscontrol on the root of my site but one subdirectory must have full accessability without autentication, I serve video from that directory to another server and can therefor not have any accesscontrol. How do I do that?
-
.htpasswd problem
2002-06-07 19:18:08 jono123 [Reply | View]
Great series. I've learned so much.
Would buy the book.
I can' get the password file going.
When i type htpasswd -c /Library/Webserve/ .htpasswd (my user name) to the terminal, i just get the help instructions echoed back.
Using pico i successfully created a .htpasswd file. (owned by my user account with read/write permission. But, i don't know know to create encypted password. I can't simply use something like Vcv7xTIIW6g7U... in your example below, can i?
dan:Vcv7xTIIW6g7U
mishka:3c4T6IdfWweU
Help? Thanks.
-
Problem setting up the User CGI bins
2002-05-29 15:59:09 brassapple [Reply | View]
I must join with everyone and thank-you for this series. It's a much needed hole you have filled in the Mac World here.
On to my problem...
I am trying to set up the User-Based Configurations and I guess I'm missing something!
I've changed my user config file to this:
<Directory "/Users/geopaula/Sites/">
Options Includes Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ScriptAlias /~geopaula/cgi-bin/ "Users/geopaula/Sites/cgi-bin/"
Server Side Includes work fine now but while the root cgi-bin works fine (ie localhost/cig-bin) per your part 2, calling either the directory itself or anything in it using: http://localhost/~geopaula/cgi-bin/ will give me a:
Not Found
The requested URL /~geopaula/cgi-bin/ was not found on this server.
If I comment out the line:
ScriptAlias /~geopaula/cgi-bin/ "Users/geopaula/Sites/cgi-bin/"
then the message goes away and I can get to a cgi script in the folder but instead of excuting the script it just dumps it out. The scripts are the same ones you used earlier to test with the inital cgi setup for the root (localhost/cgi-bin) and they worked fine there. I've chmod'd the scripts to 755 to no effect.
Any ideas as to where I've screwed up your kind instructions?
Thanks in advance!
-
User directory as 'root' on server
2002-05-28 10:33:22 pink_frankenstein [Reply | View]
How can I make a User directory on the webserver act as a 'root'?
I want to be able to put a URL in an <a href...> or image tag with a beginning " / " so that it goes to the 'root' directory of the user rather than the root directory of the server.
So i want an image tag like this:
<img src="/images/logo.gif"> to go here
http://127.0.0.1/~username/images/logo.gif
rather than to where it goes to now which is
http://127.0.0.1/images/logo.gif
also, if someone could tell me the technical term for what it is i am trying to do i would appreciate it.
thanks
-
Updating Config File - finally worked
2002-05-21 21:22:38 sanjuanio1 [Reply | View]
These articles are the best tutorial/intro on any computer subject that I have been able to find so far. Thanks!
It took me forever to get the CGI scripts to come up on my localhost site. I went to "Web Sharing" and clicked start and stop to restart the Apache webserver as indicated, but it never turned on the CGIs.
Finally, I restarted the computer and that did the trick. Could it be that because I did not click the lock at the bottom left on web sharing that it did not cause the changes I made to httpd config file in pico to take effect?
And when is #7 coming?
thanks again.
-
Changing .conf has no effect
2002-04-23 20:13:02 loopless [Reply | View]
I have modified my andrewc.conf file
<Directory "/Users/andrewc/Documents/SoftwareDev/Java/RMI/Trim">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
to point to a new directory, yet when I enter the http://127.0.0.1/~andrewc/
I keep getting the default user page in the ~/Sites folder.
error_log shows,,,,,
Processing config directory: /private/etc/httpd/users
Processing config file: /private/etc/httpd/users/andrewc.conf
The last lines in the error_log are
statfs failed because: Permission denied
statfs failed because: Permission denied
access_log shows
127.0.0.1 - - [23/Apr/2002:20:05:51 -0700] "GET /~andrewc/ HTTP/1.1" 304 -
127.0.0.1 - - [23/Apr/2002:20:05:52 -0700] "GET /~andrewc/images/macosxlogo.gif HTTP/1.1" 200 2829
127.0.0.1 - - [23/Apr/2002:20:05:52 -0700] "GET /~andrewc/images/apache_pb.gif HTTP/1.1" 200 2326
127.0.0.1 - - [23/Apr/2002:20:05:52 -0700] "GET /~andrewc/images/web_share.gif HTTP/1.1" 304 -
-
Changing .conf has no effect
2002-04-24 20:09:10 Kevin Hemenway |
[Reply | View]
Yup, you're confusing the values of the different config files. Basically, the tilde character (the ~ in ~andrewc/) is magical, and has little to do with the <Directory> defined in your andrewc.conf file. There are a couple of different ways of doing what you want, but the most understand is to use an "Alias", like so:
Alias /~andrewc/ "/Users/andrewc/Documents/SoftwareDev/Java/RMI/Trim"
You'd throw that in your andrewc.conf right above your <Directory> declaration (actually above or below - doesn't make a difference). You also want to make sure that your Documents directory, as well as all the subdirectories leading up to your Trim destination are set for 755 permissions. Otherwise, Apache won't be able to serve documents from that location.
I talk a bit about the "Alias" directive in the recently released Part 6, and will discuss the tilde character and it's magic in part 7 (not yet released).
-
Error starting apache
2002-04-20 09:45:49 [Reply | View]
Here's what happens:
[localhost:var/log/httpd] phantom% apachectl restart
/usr/sbin/apachectl restart: httpd not running, trying to start
fopen: Permission denied
httpd: could not open error log file /private/var/log/httpd/error_log.
/usr/sbin/apachectl restart: httpd could not be started
I tried removeing error_log(after making a backup, of course) and I get the same error. Tried using the backup httpd.conf to no avail. Thanks for your help.
-
Error starting apache
2003-04-01 04:19:02 anonymous2 [Reply | View]
This message comes when U don't have the root password. Plus some instance(Processes) of Apache/HTTPD is already running.
So log in as root. Kill all the associated processes, then log in from ur UserID & start, it should work...
:Ajit
-
Error starting apache
2003-04-01 04:17:48 anonymous2 [Reply | View]
This message comes when U don't have the root password. Plus some instance(Processes) of Apache/HTTPD is already running.
So log in as root. Kill all the associated processes, then log in from ur UserID & start, it should work...
:Ajit
-
Error starting apache
2002-04-21 20:05:02 Kevin Hemenway |
[Reply | View]
Try "sudo apachectl restart". You'll be asked for a password, which should be an administrative one.
-
localhost while offline
2002-04-19 12:48:41 [Reply | View]
I still cant get localhost or 127.0.0.1 while I'm offline. If I get on load a page then get off I can get this but not otherwise. Something to do with IE?? -
localhost while offline
2002-06-26 06:14:20 mark.asbach [Reply | View]
This problem is related to Mac OS X's default lookup behaviour that tries to ask a DNS first. The sideeffect beeing that localhost can't be resolved without a network, Mail hanging when startet offline, the computer pausing for 10 minutes when startet offline, etc.
To get rid of this, you need to do two steps:
- First configure the lookup order in Netinfo. See "man lookupd" for this. The example is good, so take most of it into your Netinfo config. Make a global lookup order that asks the Netinfo-Agent first, and the NILagent afterwards. Add a DNS lookup order that uses NIagent, cacheagent, DNSagent and NILagent in this order.
- Add an entry for localhost and broadcasthost to the netinfo database. -
localhost while offline
2002-04-19 15:34:36 Kevin Hemenway |
[Reply | View]
I've had occasional problems with IE and the local server (90% of the time, I can't access localhost, but can get 127.0.0.1 fine). Have you tried other browsers? (I've had no issues with Mozilla or iCab).
-
Apache Permissions and PHP mkdir()
2002-04-10 08:49:55 tedmasterweb [Reply | View]
On OS X by default Apache runs as the user www and belongs to the group www. Also, by default, when I create a new directory in /Library/WebServer for use as a virtual host (for development purposes, let's say), the directory is created with me as the owner and admin as the group. This is a problem if you want to allow Apache to modify the directory structure because www is not a member of the admin group.
Unless I set the write permissions for the new directory to all writable (773, for example), mkdir() fails due to permissions.
My question is, is there a good resource out there that discussions or demonstrates how to manage user permissions without just hacking away (so that errors are handled gracefully)?
I realize I can just make the directory world-writeable, which isn't a terrible alternative given that this is on my development machine, but it doesn't seem like the right thing to do.
Sincerely,
Ted Stresen-Reuter -
Apache Permissions and PHP mkdir()
2002-04-16 17:24:37 Kevin Hemenway |
[Reply | View]
Apache does come with a "suexec" option, which allows you to say "hey, run these CGI scripts as morbus/users". By so doing, all files your scripts create would be owned by the "morbus" user, and would have the default umask normally set (644, I believe).
I don't know if PHP has the same ability, but it does have a chown function so you may want to experiment there.
-
Almost, But Not Quite: .htaccess
2002-04-06 07:16:45 jgbutler [Reply | View]
Thanks for a very informative series. It's been a great help to me and just about convinced me to dump MS IIS and move on over to Mac OS X with Apache!
One thing, though...
I've ALMOST got that ding-dang .htaccess deal working, but not quite. Perhaps you can see what I've missed...
After successfully making .htpasswd, I created a .htaccess file with the following in it:
AuthName "Uber Goober Ad Campaign"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user
I put .htaccess in /Library/WebServer/Documents, but it has no effect. Index.shtml is served up and no authentication is requested when the server is accessed.
I'm pretty sure I've got .htpasswd correctly built cuz authentication WILL work for the ENTIRE Website if I put the Auth lines in httpd.conf.
I should also mention that httpd.conf contains the following:
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Thanks for your help!
--Jeremy Butler
-
Almost, But Not Quite: .htaccess - SOLVED!
2002-04-11 09:37:05 jgbutler [Reply | View]
I finally solved the mystery!
The culprit: BBEdit!
I used BBEdit to create a new .htaccess file cuz I didn't know nuthin bout no pico or vi or whatever. I had been using BBEdit to change httpd.conf and such and it worked just fine, but unbeknownst to me it had created .htaccess with MAC-style line-breaks, not UNIX-style ones.
The bastid!
I guess cuz httpd.conf was a pre-made file it already had Unix line breaks and BBEdit kept it that way, but when I created a NEW file, it decided that Mac line breaks would be ever so much nicer. I only figured this out after poking around in BBEdit's "save as" options. Once I changed the "save as" to Unix line breaks, password authentication began working like a charm.
I guess the Mac-Unix convergence ain't exactly all converged and such.
--Jeremy
-
Almost, But Not Quite: .htaccess - SOLVED!
2002-04-16 17:20:08 Kevin Hemenway |
[Reply | View]
Jeremy,
I'm a huge fan of BBEdit. It only makes sense for a Mac application to default to Mac line feeds when it creates a brand new document. Note, however, that if you don't like this behavior (as I didn't), then you can tweak the "new file" settings. Under BBEdit 6.5, this is under Preferences > Text Files: Saving and Default Line Breaks.
Don't be so quick to blame BBEdit ;) -
Almost, But Not Quite: .htaccess - SOLVED!
2002-05-02 09:16:37 naclay [Reply | View]
About BBEdit... I cant save a file with a "." as the first character in the file name. i.e. I can save a file as "htaccess" but not ".htaccess". Is there some other option I need to change?
-NC -
Almost, But Not Quite: .htaccess - SOLVED!
2002-07-15 13:27:06 jgbutler [Reply | View]
This is addressed in the BBEdit FAQ at
http://www.barebones.com/cgi-bin/faq/faqgroup.pl?BBEdit_General#General_-_12
You might also want to look into TinkerTool, which will make "dot" files visible in Finder.
Regards,
Jeremy
-
documents.htpasswd
2002-03-22 04:42:11 redleader [Reply | View]
After creating everything exactly as directed in the article I ended up with an .htpasswd file named 'documents.htpasswd'
When I browse to http://127.0.0.1/ I get the message "Internal Server Error"
If I comment out the last lines in the .htaccess file, namely;
AuthName "Uber Goober Ad Campaign"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user
it works as normal responding with "Gleefully Served by Mac OS X" -
documents.htpasswd
2002-03-29 14:08:47 Kevin Hemenway |
[Reply | View]
Not entirely sure how you ended up with "documents.htpasswd" - it should just be called ".htpasswd".
-
500 error still with CGI script
2002-03-15 16:34:58 bdoltens [Reply | View]
Can someone please help me?
I can successfully run the test-cgi from my browser, but a downloaded perldiver.cgi will not run.
I desired to use /Users/bdoltens/Sites/cgi-bin as a folder for cgi scripts, so I made a
<Directory "/Users/bdoltens/Sites/cgi-bin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
just after the <Directory /> bit in httpd.conf. Addhandler cgi-script .cgi is uncommented. ScriptAlias is commented out.
by typing perl /Users/bdoltens/Sites/cgi-bin/perldiver.cgi in the terminal, the program runs and outputs good html. Still, the browser reports a 500 when I attempt to access the script.
i have chmoded the file as 755, or 775, and, not really understanding the specifics of chmod, i tried also "a+w," but nothing really works.
the error_log tells me two things,
(2)No such file or directory: exec of /Users/bdoltens/Sites/cgi-bin/perldiver.cgi failed
and then, premature script headers.
Thanks for listening. Great articles, even if I don't fix this it was fun using the terminal for something. -
500 error still with CGI script
2002-03-19 14:11:37 Kevin Hemenway |
[Reply | View]
I've responded here.
-
Personal configurations and passwd authentication
2002-03-11 03:42:19 spiffyman [Reply | View]
First, I just want to say thanks for a really great tutorial. After reading the Terminal tutorials and yours, I'm planning on ordering my first O'Reilly books. If they're anything like yours, I know they'll be good.
In the meantime, though, I'm having a few problems.
After configuring my .conf file (jboyd.conf), I cannot access localhost or 127.0.0.1, and when I try to access /~jboyd/ with localhost, it gives me a 403 Forbidden error. The .conf looks like this:
<Directory "/Users/jboyd/Sites/">
Options -Indexes MultiViews
AllowOverride None
Order deny,allow
Deny from all
Allow from localhost
</Directory>
I've also tried "Allow from 127.0.0.1" -- to no avail.
(An incidental question: can we set several IP-specific allows or denies using commas or spaces to differentiate them?)
Meanwhile, accessing /~jboyd/ at 127.0.0.1 does not ask for any authentication. I've created an .htaccess file via pico (which now resides in my Sites directory) with the following pertinent lines:
AuthName "Jeremy Boyd's Personal Training Grounds"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require user jboyd
Yes, the .htpasswd file exists, and yes, jboyd is in it. I'm unsure whether the .htaccess file is in the right place, though.
Any help would be appreciated. Thanks again for great articles, but no thanks for enthralling me and keeping me up all night. ;-) -
Personal configurations and passwd authentication
2002-03-11 17:00:44 Kevin Hemenway |
[Reply | View]
When you get that 403 error, check your error logfile - does your IP address show as 127 or localhost? If it doesn't, then you'll need to add that IP into your "Allow" line. You can only have one IP, IP range, or hostname per "Allow" line.
Finally, authentication will NOT work unless you've told Apache to allow authetication under the Sites directory. This involves opening your username.conf file (located in /etc/httpd/users/username.conf) and adding "AllowOverride AuthConfig" (for just authentication control) or "AllowOverride All" (to allow overriding of all default Apache directives). -
Personal configurations and passwd authentication
2002-03-11 18:37:51 spiffyman [Reply | View]
Thanks for the help, but I'm still having problems. The error log reads my static IP address, so I changed the .conf file to read:
<Directory "/Users/jboyd/Sites/">
Options -Indexes MultiViews
AllowOverride All
Order deny,allow
Deny from all
Allow from my.address.is.here
</Directory>
Still Forbidden, and still no password authentication. Also, I still can't access the DocumentRoot using localhost or 127.0.0.1. I didn't think my personal .conf file or my .htaccess file would change that. Am I missing something?
Thanks a bunch. -
Personal configurations and passwd authentication
2002-03-13 20:15:36 Kevin Hemenway |
[Reply | View]
What do you have in the /Users/jboyd/Sites/ directory? Is there a index.html or index.htm file in there? As it is now, with "-Indexes" turned off in your config, I'm thinking that Apache's trying to resolve an index *first*, before the user authentication.
First things first, change "-Indexes" to just place old "Indexes", so that automatic indexes are created. THEN try getting to /~jboyd/ and tell me what you see.
Concerning your DocumentRoot, no, an .htaccess file shouldn't be able to harm that, but using you could do some damage with your user .conf file. If the .conf file is all you've shown me here though, then it shouldn' t be a problem.
Finally, what are the contents of your error_log, shortly after you get the 403 Forbidden error message?
-
editing /etc/httpd/users/<username>.conf breaks web access to Sites folder
2002-03-10 14:37:39 grosventre [Reply | View]
Following the examples in this very informative article, I edited the /etc/httpd/users/michaelh.conf file. After saving it and trying to access http://127.0.0.1/~michaelh/, I get nothing but a 404 error, as seemingly the Sites folder is no longer being served by apache. Suggestions?
Thank you,
Michael -
editing /etc/httpd/users/<username>.conf breaks web access to Sites folder
2002-03-11 16:49:07 Kevin Hemenway |
[Reply | View]
Suggestions? Not really, except that whatever change you made is causing the issue. Do you still have an index.htm or index.html file in that directory? What does your error.log show you? What are the contents of your username.conf file? Are you sure it's a 404 error that you're getting? -
editing /etc/httpd/users/<username>.conf breaks web access to Sites folder
2002-03-11 19:15:38 grosventre [Reply | View]
Yes, there is an index.html fil. The error_log entries relevant are:
[Mon Mar 11 19:55:59 2002] [error] [client 199.104.80.94] File does not exist: /Users/michaelh/public_html/
and
[Mon Mar 11 19:56:58 2002] [error] [client 199.104.80.94] File does not exist: /Users/michaelh/public_html/index.html
After various incarnations, the username.conf file now looks like this:
<Directory "/Users/michaelh/Sites/">
Options Includes Indexes Multiviews
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
ScriptAlias /~michaelh/cgi-bin/ "/Users/michaelh/Sites/cgi-bin/"
Pretty much per one of your examples
The error page:
Not Found
The requested URL /~michaelh/index.html was not found on this server.
------------------------------------------------------------------------
Apache/1.3.22 Server at 127.0.0.1 Port 80
and if that's not a 404 error, I haven't been configuring apache on FreeBSD boxes for the past five years :)
I definitely appreciate these articles,. as they help make testing my cgi work much easier locally.
Thanks for any ideas you may come up with,
Michael
-
editing /etc/httpd/users/<username>.conf breaks web access to Sites folder
2002-03-13 20:10:28 Kevin Hemenway |
[Reply | View]
Whoa, where did this "public_html" directory come from, as per your error message? "public_html" is the equivalent of "Sites", only for other distributions like Redhat, SuSE, and so on and so forth - its kinda like the default user website directory.
Open up your httpd.conf file and do a search for the UserDir directive. That should be set to "Sites", not "public_html". If it's not, do a search on the rest of the conf file for "public_html" - that's what's causing your problem. -
editing /etc/httpd/users/<username>.conf breaks web access to Sites folder
2002-03-14 10:50:31 grosventre [Reply | View]
Well,
at one point, after breaking my httpd.conf, I had to restore it from the httd.conf.bak that was included in my apache. Following your prompt, I found the lines:
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
After replacing the public_html, with Sites, as well as a couple of other tweaks to httpd.conf with respect to the other directories, my Sites folders behave identically to my /Library/Webserver/ folder.
I suppose the httpd.conf.bak, was a generic Apache backup file(?), using the public_html directory , instead of Sites, or htdocs (my accusatomed Free BSD default.
Mystery solved. Thanks!
-
How do I password protect a different directory?
2002-03-06 05:21:07 hammer09 [Reply | View]
I have been able to get the password protection to work properly as explained in the turtorial but it is securing the main site (i.e. Library/WebServer/Documents). What if I would like to secure the directory Library/WebServer/Documents/Clients? Thanks in advance for your help. -
How do I password protect a different directory?
2002-03-11 16:45:42 Kevin Hemenway |
[Reply | View]
The .htaccess file is the key to the whole thing. In the example in the article, you can move the '.htaccess' file to any directory, and that directory will be secured. In your case, simply move .htaccess to your Clients directory, and the passwords you set up in the .htpasswd should work there.
-
Alias' Don't work
2002-03-04 16:59:46 bligh68 [Reply | View]
In Mac OS 9 I used alias' to store 2500 pictures on a CD Then used the alias' in my webpage folder to accesses those pictures on the CD.
Now that I'm running Apache those alias' don't seem to work. I don't get an error message, I only get a line of text with the pictures URL.
If I replace the alias with the real picture things work fine. But I really don't won't to do that. I would rather stick with the alias'
cheers -
Alias' Don't work
2002-03-11 09:02:27 Kevin Hemenway |
[Reply | View]
In OS X, an "alias" in the Finder is the same as an "alias" under OS 9. However, Apache lives under the BSD layer of OS X, so "alias"es don't work the same. What you're looking for are "symlinks".
If you're picture directory is called (for example), "My Real Pictures", and it lives in your Mac HD, and you want a "pictures" directory under your personal website, run these commands in the Terminal:
ln -s "/My Real PIctures" "/Users/username/Sites/pictures/"
chown 755 "/My Real Pictures"
You'll also have to tell Apache to follow symlinks when it's serving various webpages. To do so, edit your /etc/httpd/users/username.conf file, and add "FollowSymLinks" to the "Options" line. Finally, restart Apache, and things should be working for ya.
-
Link to folder outside /Sites folder -- possible?
2002-02-27 23:45:30 dredjohn [Reply | View]
I've read through the series here -- very novice friendly. But I haven't found a way to do something that I perceive is very basic.
I've installed a php file manager so that I can let my friends and family browse through a pictures folder I have set up in my user directory.
For the sake of discussion, my website address is http://192.168.1.1/~marty/
On my harddrive this equates to /users/marty/Sites/
Pretty standard.
The pictures folder is located at:
/users/marty/Pictures/
I've tried creating a symbolic link:
ln -s ~/marty/Pictures ~/marty/Sites/pics
This makes "pics" a linked folder. I can cd to it in terminal, but if I go to my php filemanager it only sees the pics folder as a file. Clicking on it produces an error.
If I go directly to the url:
http://192.168.1.1/~marty/pics/
I get an error 403 about permissions.
I've tried editing marty.conf. It now reads:
<Directory "/Users/marty/Sites/">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I've also tried fiddling with settings in httpd.conf -- basically mimicking the settings above in areas I thought might make a difference.
Nothing helped.
But one that WAS interesting is despite all of these problems, I CAN link to any folder above the /Sites directory (i.e. /users/marty/Sites/temp/transfer)
In the above example, I can create a link of "transfer" in the Sites directory and access it with ease in the php filemanager AND through url access. Very strange...
I'd think it's quite common for website designers to link to folders on different harddrives or in directories outside of the Sites folder.
Maybe I'm wrong. Hopefully there is an easy answer to this, as I'd rather not have to duplicate all of my files - or move my pictures into the Sites directory.
Thanks in advance to any who have tips. -
Link to folder outside /Sites folder -- possible?
2002-03-11 08:55:53 Kevin Hemenway |
[Reply | View]
What are the permissions of your Pictures directory? If you want to use symlinks, than the folders and files that you link to must have permissions that allow Apache to serve them. By default, the Pictures directory has "600" permissions, which only allow the user to read and write. If you want Apache to serve from that folder, you need to give it "755" permissions, which can be done with "chmod 755 /Users/marty/Pictures/". Using a similar configuration as yours, fixing the permissions was the clincher to get things working on my end.
Your PHP program problem is a fact of life - some programs, either by fault of the language or the developer, don't understand symlinks, and will show them as a file, as you've been seeing. I'm not sure how PHP handles symlinks, but I'm sure you can Google a bit for the answer.
-
.htaccess syntax
2002-02-24 10:45:16 pbates [Reply | View]
In trying to implement password access, I am generating a 500 error. The error log file gives me the following line:
/Library/WebServer/Documents/.htaccess: AuthName takes one argument, The authentication realm (e.g. "Members Only")
Here is the contents of .htaccess
AuthName "Testing"
AuthType Basic
AuthUserFile /Library/Webserver/.htpasswd
require valid-user
Interestingly, if I cat .htaccess, I see only the last line of the file unless I use the -v option.
BBedit shows me that there are line breaks after each line but ???
Ideas?
Thanks,
Pete
-
.htaccess syntax
2002-02-25 08:23:50 Kevin Hemenway |
[Reply | View]
Sounds like a similar problem reported earlier. Check out:
http://www.oreillynet.com/cs/user/view/cs_msg/6238
-
Operation not permitted
2002-02-23 05:15:12 adamsdv [Reply | View]
I've been frustrated thru this tutorial by a consistant and troubling problem. Though I know the admin password, I don't seem to be able to change access rights on the files in /etc/httpd, or ...CGI-executables. I was able to create a new test-cgi file by copying the existing file's contents to a new test2-cgi with BBEdit. This cgi then worked just fine. I can change rights/owner on that file just fine, but if i try to do the same on test-cgi, I get "Operation not permitted" the same goes for trying to do anything with httpd.conf. I'm totally lost as 'su' then password simply responds with 'Sorry' Any ideas what my problem is?? Thanks -
Operation not permitted
2002-02-25 08:22:12 Kevin Hemenway |
[Reply | View]
Are you just typing "su" and nothing else? There are two ways to do something with administrative rights under the terminal. There's "su" and "sudo".
Sudo looks like:
sudo chown -R adamsdv:staff *
It says "hey! do the next command as an administrative user. prompt me for the password, else use the one I typed in less than five minutes ago".
Su, on the other hand, looks like:
su [username]
so:
su root
would ask for your root/admin password, and then you'd be acting as the root user until you explicitly said "exit" (ie. all commands you typed in would be executed with administrative privileges).
Does that help at all? -
Operation not permitted
2002-02-25 14:56:57 adamsdv [Reply | View]
Thanks, but the problem persists.
I type "su root", the computer replies with "Password:" I enter the password (no question that it is the one I installed OS X with, and it is the same one that I login with) the computer replies "Sorry"
Any Ideas?
P.S. I'd tried the sudo thing, but it didn't appear to work, but when I executed the sudo chown... command listed in your response, it did, and I could then modify the httpd.conf file. Hey, now I own it. I'm at a loss as to why I can't SU then just chown ... (perhaps also of interest, I can login with my OS X short user name, but If I try to login as root (from a shell), after the password prompt, it says "root login refused on this terminal." I'm not really a UNIX person so is there something wrong or just something I don't understand?
Thanks again, and the Series is really as thoroughly excellent as O'Reilly's books have been. Kudos!
-
Operation not permitted
2002-02-27 23:50:43 dredjohn [Reply | View]
I'd use NETINFO MANAGER in the Application/Utilities folder. Go to DOMAIN at the top (I think that's what it's called) and SECURITY. There is an option to AUTHENTICATE. Do this to allow you to change settings. Then go back to SECURITY and say ENABLE ROOT.
Follow the instructions. Log out, log in as root with the password.
When you're done. Log out, log back in as yourself -- go back to the NETINFO MANAGER and DISABLE ROOT.
Although the EASIEST way is to use BBEDIT (available at versiontracker). There is a demo available -- might be worth the purchase -- it will let you edit/save ANY file to yourhearts content without having to go through the hassle of enabling/disabling root priveledges.
-
Blocked Port 80
2002-02-22 22:38:28 edwintan8787 [Reply | View]
My ISP blocks port 80, so I can't serve my pages.
May I know if there is a workaround?
i want to change the port -
Blocked Port 80
2002-02-23 05:20:34 adamsdv [Reply | View]
in the httpd.conf file you will find a line that says "Port 80", just change the 80 to another port and restart Apache. You can then access this port from a web browser by placing :portnum (that's a colon, then the port number) after the server address. so if you were using http://10.0.0.15/~edwintan as you URL, and you moved the server to port 79, now use http://10.0.0.15:79/~edwintan
Hope that helps. -
Blocked Port 80
2002-02-23 19:10:55 edwintan8787 [Reply | View]
thanks A LOT!!!!
but may I know how I can get it to work from behind my (DHCP) router?
thanks -
Blocked Port 80
2002-02-24 09:49:00 adamsdv [Reply | View]
Well, now that looks like a problem. If your router connects a WAN with a public IP address to your LAN (even if the LAN is only the router and your computer) there are two addresses the WAN side and the LAN side. Many routers connect on the WAN side to your ISP. This connection may have either a static IP assignment, or a DHCP'ed one. On the LAN side, most routers will act as a DHCP server to assign private IP addresses to machines on the LAN, it will also act as a gateway to the WAN and do some network address/port translation. On the WAN side you may be able to get your ISP to assign you a static IP, or add a DNS entry for you. On the LAN side, you can usually disable or bypass DHCP. From here the number of combinations can get overwhelming if I try to explain each of them. If you can tell me a few things, like what type of ISP service you have (is it DSL, Cable Modem etc), what is the IP number fo your computer and what's the configuration (is it set to "using DHCP", "manually using DHCP Router" etc) and anything else you know about your router, maybe I can help sort it out.
-
Internal Server Error
2002-02-18 05:25:52 hammer09 [Reply | View]
I have been working on part four of your tutorial where I am trying to get the password authentication to work. After going through all of the steps, I go to my site and get a page that says "Internal Server Error." When I go to the error log, there is an entry that says: [Mon Feb 18 08:08:37 2002] [alert] [client 192.168.0.40] /Library/WebServer/Documents/.htaccess: AuthName takes one argument, The authentication realm (e.g. "Members Only"). I replaced the default realm with one that says "My Company's Authentication" but other than that, I beleive everything is correct. Any help would be greatly appreciated. -
Internal Server Error
2002-02-18 08:18:12 Kevin Hemenway |
[Reply | View]
Two things to verify:
- Make sure that "My Company's Authentication" is QUOTED after AuthName. If there are no quotes around it, then it would be considered multiple arguments, and thus you'd get the error.
- Make sure that the line encoding of your .htaccess file is set for Unix newlines. If it's Mac or Windows newlines, then that could give the "single argument" warning. -
Internal Server Error
2002-03-12 21:11:07 kak [Reply | View]
I know I'm coming late to the party but I'm having the identical problem described previously. I've setup the .htpasswd file and it seems fine. I have setup a .htaccess file in the directory I want to protect.
Trying to access this directory gives me the 500 internal server error and then the 'AuthName takes one argument' warning in the error log.
I have created the file using sudo pico and then typing it straight in (so I assume the line endings are OK). Is this a correct assumption?
I definitely have quote around the Authname.
The full .htaccess file is:
AuthName "test"
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require user david kim
Anything else I can try - this is killing me!
Oh, and one more thing - is it wise/unwise to use the httpd.conf file to change the name of the .ht files to something that can be more easily written to the system - like apple.htaccess or whatever?
thanks
-
Internal Server Error
2002-02-18 09:04:40 hammer09 [Reply | View]
Thanks morbus, You were absolutely correct. The .htaccess file that I saved had Macintosh line breaks. As soon as I resaved it as Unix, it worked like a charm. Is there a way to make that the standard way that bbedit saves the files? A preference or something? Thanks again for your help and please keep these articles coming or write your own book about serving apache on OSX. I'd be your first customer! -
Internal Server Error
2002-02-20 12:28:39 Kevin Hemenway |
[Reply | View]
Yup, you can set BBEdit to automatically save files in Unix linefeeds - I've my 6.5 installation set that way. Take a look-see in your BBEdit Preferences, and I'm sure you'll find it.
-
can't save .htaccess file
2002-02-13 06:08:37 pablo2001 [Reply | View]
I seem to not have the authority to save the .htaccess file. I'm logged in as an administrator, but not as the root administrator. Is this the reason?
I'm using BBEdit 6.5 and also tried unsuccessfully in TextEdit. -
can't save .htaccess file
2002-02-13 13:36:27 Kevin Hemenway |
[Reply | View]
Generically, OS X through the GUI, does not allow you to save .htaccess files without extra configuration. Your best bet is to get into a Terminal, type "touch .htaccess" where you want the file, and from there, edit in your favorite GUI editor. -
can't save .htaccess file
2002-02-13 14:12:32 pablo2001 [Reply | View]
Thanks!
Tried it and it worked great.
The thing I had done before this was to use BBEdit from inside OS 9.2 partition. It enabled me to create the file, but I don't know if I did some kind of harm to the OS X environment.
Your way is much better.
-
yoiks... .help
2002-02-08 02:03:08 hench [Reply | View]
following your articles with great interest and ideal starting ground for an apache/unix newbie. (god I hate that word, and at my age). Anyway, having probs with p/w authentication.
I created an access file:
library/webserver/documents/.htaccess
contents of the file are:
AuthName “Login”
AuthType Basic
AuthUserFile /Library/WebServer/.htpasswd
require valid-user
then created the p/w file:
htpasswd –c /library/webserver/.htpasswd username
contents of this file are:
username: o/29Pjetcetc
this didn’t contain: less /Library/WebServer/.htpasswd as in your example so I manually added but the end result is the same with or without this line of text.
I then get the following from browser:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Obviously it is seeing the custom error doc but I don’t get option to enter a login/p/w
Access_log:
[username:/library/webserver]tail /var/log/httpd/access_log
127.0.0.1 - - [08/Feb/2002:06:16:45 +0000] "GET /index.php HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:06:16:46 +0000] "GET /index.php HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:06:22:38 +0000] "GET / HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:06:23:25 +0000] "GET / HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:06:23:26 +0000] "GET / HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:06:23:34 +0000] "GET /index.php HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:07:36:44 +0000] "GET /index.php HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:08:24:18 +0000] "GET / HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:08:27:57 +0000] "GET / HTTP/1.1" 403 -
127.0.0.1 - - [08/Feb/2002:09:07:48 +0000] "GET / HTTP/1.1" 403 -
Error_log
[username:/library/webserver]tail /var/log/httpd/error_log
[Fri Feb 8 08:24:18 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents
[Fri Feb 8 08:24:18 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents/oops.html
[Fri Feb 8 08:27:36 2002] [notice] caught SIGTERM, shutting down
[Fri Feb 8 08:27:38 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Fri Feb 8 08:27:38 2002] [notice] Apache/1.3.22 (Darwin) PHP/4.0.6 configured -- resuming normal operations
[Fri Feb 8 08:27:38 2002] [notice] Accept mutex: flock (Default: flock)
[Fri Feb 8 08:27:57 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents
[Fri Feb 8 08:27:57 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents/oops.html
[Fri Feb 8 09:07:48 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents
[Fri Feb 8 09:07:48 2002] [error] [client 127.0.0.1] client denied by server configuration: /Library/WebServer/Documents/oops.html
-
yoiks... .help
2002-02-08 08:22:58 Kevin Hemenway |
[Reply | View]
Before I go any further, remove that "less" line from your .htpasswd file. It shouldn't be in there. "less" is a command line utility to show the contents of a text file.
First, some questions:
1) What do you have in your /Library/WebServer/Documents folder? Do you have an index.html file? Or index.shtml? Or index anything?
2) Did you turn off "Indexes", stopping Apache's autogenerating of indexes?
-
Can't create .htaccess file
2002-02-04 02:31:42 markpalmer1 [Reply | View]
Hi,
I'm following part 4 of the tutorial and find I can't create a file with the name .htaccess by saving from BBEdit - the save button is dimmed. If I save under another name and try to edit with the finder I am told that names begining with a dot "." are reserved for system use! Also trying to cp htaccess .htaccess in the command line just fails.
What am I missing here?
Mark -
Can't create .htaccess file
2002-02-04 06:48:14 Kevin Hemenway |
[Reply | View]
You can't "cp htaccess .htaccess"? What sort of error message do you get? You're correct though - by default OS X doesn't let you create "dot files" from the Finder. There are ways around this (by turning on ShowDotFiles in your finder.plist).
Have you tried creating and editing the .htaccess file within your Terminal only (like "pico .htaccess", editing within Pico, and then saving)? -
Can't create .htaccess file
2002-02-04 08:09:32 markpalmer1 [Reply | View]
>> You can't "cp htaccess .htaccess"? What sort of error message do you get?
I dont get any error, just a return to the prompt ls -l only list a file called htaccess!
I then tried resaving as .htaccess using pico which works fine, although I did confuse myself for a while by doing ls -l without autheticating as su and of course I couldn't see anything, this I guess was my original problem.
Thanks
Mark.
-
Can't create .htaccess file
2002-02-04 10:57:53 Kevin Hemenway |
[Reply | View]
Ah yes, forgot to mention the most obvious. To see "dot files" in the Terminal, you need to do "ls -al", NOT "ls -l". The "-a" says "show all files, including dot files".
-
Frustrated!
2002-02-03 05:09:28 pattyb777 [Reply | View]
Yesterday I made a mistake in my httpd.conf file and I could not get the web server to restart. This morning I checked it against httpd.conf.bak and found the error. Once I fixed it, I was able to start the web server. Then I continued on with this wonderful tutorial. After taking the recommended steps, I once again could not get the web server to start. I checked against the .bak file again, line by line, and removed the changes I had made. I did leave it enabled for cgi, php and ssi. But now the server will not start again! I've rechecked the file several times. Is there anything else that could be preventing the server from starting?
Thanks, Pattyb -
Frustrated!
2002-02-03 13:43:01 Kevin Hemenway |
[Reply | View]
Patty,
Run 'httpd -t' on the command line, and it should report to you the line that is stopping Apache from starting. You can post it here if you can't fix it yourself, and I'll help you out. -
Frustrated!
2002-03-30 17:39:06 kiwipeso [Reply | View]
Hi there, I'm getting the following from the Terminal:
[203-79-120-174:~] root# httpd -t
Syntax error on line 289 of /etc/httpd/httpd.conf:
Invalid command 'ExtendedStatus', perhaps mis-spelled or defined by a module not included in the server configuration
I'm not the only person getting this error from a clean install of Mac OS X.1.3 , it is basically hanging the start apache option in the sharing preference.
Thank you, http://neural.net.nz (when apache is going)
-
DirectoryIndex for .htm
2002-02-02 16:44:25 twhid [Reply | View]
note: i posted this in regards to part 1, but it made more sense here as you cover this topic in this article.
first, just want to say these articles are great and it's really helped me to understand the awesome power under mac's new luscious interface. great job.
my question with some strange observations.
i set a local staging site for my website using your articles and apache on osX. but my hosting service long ago insisted i name my index file as index.htm (they no longer do, but there are hard links that break if i change it to .html).
just to make sure all files are named locally as on my host server, i wanted to change the default DirectoryIndex to index.htm or simply 'index' using this wild card idea on got from apache's online docs.
but it doesn't work. i still get the nasty default directory listing when using http://127.0.01. BUT, when i used http://localhost, it worked, but in an incredibly weird way. there's a fairly fat flash file (40k) on that page and it loaded as if it was coming from a remote server over my dialup!
i was online via dialup at the time, haven't tried it while offline.
any ideas?
-
Juan es muy guapo
2002-01-29 23:05:44 hayne [Reply | View]
"[1] Bonus points to those who figure out the tenuous connection between this and the Hitchhiker trilogy joke."
Could it possibly be related to the first woman on Earth? -
Juan es muy guapo
2002-01-30 04:33:07 Kevin Hemenway |
[Reply | View]
Nope, not even close :) ... -
Juan es muy guapo
2002-01-31 14:27:38 girl_intin_oss [Reply | View]
The "Hitchhiker's Guide" is a trilogy but there are five books in total. This series was originally planned as a trilogy but now has extended beyond that too. Will it stop at five like the "Hitchhiker's Guide" or will it go on? ;)
-
Juan es muy guapo
2002-01-31 14:45:50 Kevin Hemenway |
[Reply | View]
girl_intin_oss,
Have you heard that they discovered a *sixth* book on Adam's computer, after he died? Could this be a foreshadowing? HmmmMmmm. ;)






DirectoryIndex index.html /~chris/cgi/index.pyThe cgi directory is scriptaliased as such to activate cgi in the cgi directory
ScriptAlias /cgi /cgiThis serves up and runs the python script:
http://localhost/~chris/cgi/index.py
This fails with an error:
http://localhost/~chris/cgi
Why wouldn't DirectoryIndex take over and run index.py since we are accessing the ScpritAliased directory itself?
Thanks
-cv