Apache Web-Serving with Mac OS X: Part 2
Pages: 1, 2
Turning on server-side includes
Server-side includes, better known as SSIs, allow you to include content from other files or scripts into the page currently being served. This is done by Apache before the page is actually shown to the user -- they'll never know what you've included or where.
Commonly, SSIs are used to include things such as headers, footers, and "what's new" features across an entire site. When you need to change the background color of your site, for instance, you can change the header file only, and the color will be reflected immediately wherever you've included that file.
SSIs, by default, are turned off. To turn them on, we're going to use the same "search for the feature" trick we did above. Open your Apache configuration file, and search for "server side." Our only match grants us the following:
# To use server-parsed HTML files
#
# AddType text/html .shtml
# AddHandler server-parsed .shtml
Happily, this is exactly what we're looking for.
Those simple "Add" lines tell us a lot. They establish a pattern based on
what we already know about CGI. If you recall above, we could have turned
on the CGI feature for files ending in .cgi -- in other words, any file you
created with the .cgi extension (whether it was a CGI program or not),
would be treated as an executable script.
Likewise, these lines are
telling us that we can turn on the server-side include feature for files
ending in .shtml. Whether we actually use the SSI feature in these files
doesn't matter -- they'd still be treated and processed as if they
did.
This is important. You may be thinking "If SSIs are so great,
why not enable them for .html filenames?" Ultimately, it's a matter of
speed. If you have 3,000 .html files, and only 1,000 of them actually use
SSI, Apache will still look for SSI instructions in the other 2,000. That's
a waste of resources. Granted, processing SSI incurs very little
overhead, but if you're being hit 50,000 times a second, it can certainly
add up. This isn't too worrisome for our GatesMcFarlaneCo intranet, but is
good to know for your future Apache projects.
For now, uncomment
the AddType and AddHandler lines. This will turn on the SSI mojo power. But where? When we were learning about CGI, we saw a
configuration setting that said our CGIs lived in
/Library/Webserver/CGI-Executables/ -- we now have to tell Apache where we
want our SSI capability to take place.
Because we've building an
intranet, that's going to live in /Library/Webserver/Documents, that's
where we want our SSI capability to be active. Go to the top of your Apache
configuration file and search for "/Library/Webserver/Documents/". The
second result looks like the following (we've removed the commented lines
from this example):
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
You'll notice that
this looks similar to the <Directory> entry we saw when we were
looking into CGI. As before, we're going to skip the brunt of it (we'll pay
attention to our ignored lines a little bit later in our series). For
now, add the word Includes to the Options line. Options is an Apache
directive that can turn on or off different features for the
<Directory> and all subdirectories beneath it. Subdirectories can
override their parent configuration.
Because we've made changes to
Apache's configuration file, we now need to restart Apache. The easiest way to do
this is via our Sharing preference panel. Much like we started the sharing preference in part one of this series, we can stop and start to enable our changes. Do this now. Chuckle once or twice, if you must.
To test that our SSIs are working properly, rename your index.html file to index.shtml (because .shtml is the only extension we've enabled SSIs for), and edit to match the snippet below:
<html>
<body>
<h1>Gleefully Served By Mac OS X</h1>
<pre><!--#include virtual="/cgi-bin/test-cgi"-->
</pre>
</body>
</html>
Here, we're including the test CGI script into the contents of our main index
page. When you load http://127.0.0.1/ into your browser, you'll see our
"Gleefully Served" message, as well as the output of the CGI script itself.
We could just have easily created a static web page (say,
"navigation.html"), and included that within our page instead.
SSI is configured and working, but what can you do with it? What if your marketing department wants to create an image gallery of the newest ads they've planned? That's quite easy using this SSI Image Gallery article, also written by yours truly.
In my next installment, I'll show you how to turn on PHP. Until then, good luck working with CGI. And if you have questions ... comment below and the author will get back to you.
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."
Return to the Mac DevCenter.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 227 of 227.
-
no test-cgi
2008-06-29 01:01:33 NickBadAtMac [Reply | View]
i am trying to set up my own server, so that i can develop a database website, i tried til the part where it says to type chmod 755 test-cgi
the reply was chmod: test-cgi: No such file or directory
im using an Mac OS X 10.4.11 Tiger.
im stuck here. i need help
-
location change for apache config files
2008-06-11 18:24:58 robbel [Reply | View]
I couldn't get ssl and php to work on Leopard until I realized that the locations for the configuration files on my machine are in /etc/apache2, not /etc/httpd. At least for my machine the apple control panel uses this location for configuration stuff.
-
NO TEST.CGI
2007-12-11 11:40:41 Tymierb [Reply | View]
there is no test.cgi file on my mac. i got the static html page running fine but i cannot for the life of me find this file after two weeks of searching. I'm running a PowerPC G4 with OSX 10.4.11 please help me find this file.
-
Out of date and need a hand
2007-08-15 08:09:05 Michael_Janzen [Reply | View]
Hello,
This tutorial is out of date, or, i'm just a complete moron. There are no /ect/ directories in the mac file system. There is no httpd.conf file on my mac hard drive.
Apache is up and running, as tutorial 1 worked just fine.
I need help!!
-
Cannot get perl script to work using cgi
2007-05-30 10:21:35 AstroNerd [Reply | View]
I followed the tutorial and am able to get the following to work:
test-cgi which contians:
#!/bin/sh
# disable filename globbing
set -f
echo Content-type: text/plain
echo
echo CGI/1.0 test script report:
echo
echo argc is $#. argv is "$*".
echo
and a document I made from the entries called script.cgi which contains:
#!/bin/sh
echo "Content-type: text/html"
echo
echo "Something"
I can display them by just going to http://127.0.0.1/cgi-bin/script.cgi
Now the problem is I want to display something like:
#!/usr/bin/perl
#
# Program to do the obvious
#
print 'Hello world.'; # Print a message
and I get and error message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/1.3.33 Server at 127.0.0.1 Port 80
Any advice? (Note, I already did "sudo chmod 755 FileName.cgi)
-
No permission to save httpd.conf
2007-05-23 05:30:45 aquilai [Reply | View]
I'm editing the httpd.conf file in pico and when I exit and try to save it tells me i do not have permission to overwrite this file....any ideas.
Cheers. -
No permission to save httpd.conf
2008-08-28 13:50:00 Roger LaPrelle [Reply | View]
I have the same question. I can read the httpd.conf file, but I can't change it. The reply to the previous post did not address the issue. Any more ideas? -
No permission to save httpd.conf
2007-10-06 16:00:22 soundmagic1943 [Reply | View]
You may found the answer to your question, But I ma reading through this thread and found your question.
You will not find any file located at /etc/htmld using Spotlight
find the file
1. Open terminal from <Application><Utilities>
2. This will open a command window on your desktop
3. At the prompt type httpd -V
you should see a report
NOTE : this report will tell you that with MAC OSX
the file you are looking for is located at
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
3. use this command at the command line prompt
cd /etc/httpd
4. this will switch you to the directory/folder
named /etc/httpd the configuration file is located in this file - folder path
If you have not received an answer yet I hope this will be of any use for you
cheers
-
i dont understand how to find the httpd.conf file HELP
2007-04-17 01:44:09 jarodvonhoff [Reply | View]
how do i find it ive looked in spotlight but no luck HELP ME.
if you know were it is please send me an email
jarodvonhoff@westnet.com.au
-
editing user.conf versus httpd.conf file
2007-02-28 14:47:53 zimboden [Reply | View]
If you can't get SSI working on Mac OS X, try looking for a special user.config file which contains settings for sites in user folders.
I spent all morning trying to enable SSI to no avail. I was convinced my edits to the httpd.conf file weren't working. When I searched my hard drive for the string "httpd" (using unix command 'locate' since Finder's search won't see folders like "private") I came across some .conf files prepended with various usernames. I found one for myself (zimboden), so I opened it and found inside:
<Directory "/Users/zimboden/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
This looked awfully similar to the entries that I was editing in the httpd.conf file, so on a lark I changed the Options line to read:
Options Indexes MultiViews +Includes
and VOILA! finally SSI started working for me! -
editing user.conf versus httpd.conf file
2008-01-28 09:07:27 Alabamian [Reply | View]
Just to be explicit about what user file needs to be updated with Zimboden's sanity-saving line, you can find it in Leopard, here ...
/private/etc/httpd/users
There you should see at least one user.conf file. Edit this puppy as per Zimboden's additions above, and watch the CGI begin. -
editing user.conf versus httpd.conf file
2007-11-25 11:43:06 0really [Reply | View]
Thanks for this note. You saved my sanity. -
editing user.conf versus httpd.conf file
2007-02-28 14:53:35 zimboden [Reply | View]
An additional note:
A little piddly syntax thing:
I've seen example for the actual include tag "directive" as
<!--#include virtual="/includes/navigation.ssi" -->
It is important that there is no space between the # and "include".
-
errata in this file
2007-01-21 10:16:08 imagedoc [Reply | View]
Where it says "Go to the top of your Apache configuration file and search for "/Library/Webserver/Documents/" is errata...
In BBEdit you'll be searching the config file for "/Library/WebServer/Documents"
which will give the desired result he describes in this article:
######################################
The second result looks like the following (we've removed the commented lines from this example):
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
###################################
-
Panther issue
2005-01-08 22:49:17 jxpx777 [Reply | View]
I don't know if anyone is still reading this, but since I was using it, I thought others might also.
I was having an issue with implementing SSI in my system and then I realized that my file does not look like the <Director> tag that is used in the tutorial because it is separated out by comments. Mine says <Directory "/Library/Webserver/Documents">
Then there are seven lines of comment before the Options line. This was tripping me up before because I found one section of the code that looked like what was posted but then I realized it had /manual as well. Now, after a sudo apachectl graceful, it works.
Godspeed,
jxpx777
-
Error Message : test-cgi not found
2004-11-09 23:49:08 ZeeshanMaqbool [Reply | View]
I have read your tutorial and found it very useful .. but I am stuck with a simple problem.
1) If I look into finder under this path "/Library/WebServer/CGI-Executables" I dont see ne files (as u mentioned that there will be printenv and test-cgi)
2) I followed the tutorial till Part-1 done, Part-2 Page1 (but the test-cgi doesnt ececute) and access_log says :
127.0.0.1 - - [09/Nov/2004:22:46:05 -0800] "GET /cgi-bin/ HTTP/1.1" 403 284
127.0.0.1 - - [09/Nov/2004:22:49:52 -0800] "GET /cgi-bin/ HTTP/1.1" 403 284
127.0.0.1 - - [09/Nov/2004:22:50:25 -0800] "GET /cgi-bin/ HTTP/1.1" 403 284
127.0.0.1 - - [09/Nov/2004:22:59:29 -0800] "GET /cgi-bin/test-ccgi HTTP/1.1" 404 289
127.0.0.1 - - [09/Nov/2004:22:59:34 -0800] "GET /cgi-bin/test-cgi HTTP/1.1" 500 604
127.0.0.1 - - [09/Nov/2004:23:26:59 -0800] "GET /cgi-bin/test-cgi HTTP/1.1" 404 288
127.0.0.1 - - [09/Nov/2004:23:30:16 -0800] "GET /cgi-bin/test-cgi.cgi HTTP/1.1" 404 292
and error_logs says :
[Tue Nov 9 22:46:05 2004] [error] [client 127.0.0.1] attempt to invoke directory as script: /Library/WebServer/CGI-Executables
[Tue Nov 9 22:49:52 2004] [error] [client 127.0.0.1] attempt to invoke directory as script: /Library/WebServer/CGI-Executables
[Tue Nov 9 22:50:24 2004] [error] [client 127.0.0.1] attempt to invoke directory as script: /Library/WebServer/CGI-Executables
[Tue Nov 9 22:59:29 2004] [error] [client 127.0.0.1] script not found or unable to stat: /Library/WebServer/CGI-Executables/test-ccgi
[Tue Nov 9 22:59:34 2004] [error] (2)No such file or directory: exec of /Library/WebServer/CGI-Executables/test-cgi failed
[Tue Nov 9 22:59:34 2004] [error] [client 127.0.0.1] Premature end of script headers: /Library/WebServer/CGI-Executables/test-cgi
[Tue Nov 9 23:26:59 2004] [error] [client 127.0.0.1] script not found or unable to stat: /Library/WebServer/CGI-Executables/test-cgi
[Tue Nov 9 23:30:16 2004] [error] [client 127.0.0.1] script not found or unable to stat: /Library/WebServer/CGI-Executables/test-cgi.cgi
By looking at them could u plz tell me whats the prob with this CGI ..
(one more thing could someone place a copy of 'test-cgi' and 'printenv' on internet???)
Zeeshan -
Error Message : test-cgi not found
2004-11-24 20:19:41 idenrosenthal [Reply | View]
I believe the tutorial was written for an earlier version of Apache than the one supplied with Panther 10.3.x. You can learn just as much by writing your own cgi file and changing its permissions. For starters try :
#!/bin/sh
echo "Content-type: text/html"
echo
echo "Something"
or something more exotic if you like. The printenv and test-cgi scripts presented security problems I read somewhere by googling test-cgi Apache
-
Error Message
2004-09-23 08:58:54 MikeBroderick [Reply | View]
When trying to serve an ssl, I get a message in my page where the dynamic content is suppose to be displayed that says "an error occurred while processing this directive" What does this mean?
-
Uncommenting Apache config file
2004-08-05 16:54:50 mstumpy [Reply | View]
I have tried to uncomment the server side include lines but can't save them because of permissions. I tried chmod 775 /etc/httpd/httpd.html but it doesn't work. How can I save these changes?
-
test-cgi, printenv missing
2004-03-31 19:31:32 monica1 [Reply | View]
I can't find any of these cgi's on my mac.
How can I get them?
-
cgi not working with external programs.
2004-03-03 16:57:03 juferban [Reply | View]
Hello.
I have configured apache to work with cgi and it seems to wrok well but when I wrote a cgi that has to create two sequence files and perform and alignement with BLAST program and then read the output the cgi seems to not work.
I test the script from the comand line and works well so I don't know where is the problem.
Any suggestion??? Thanks a lot.
-
questionable log entries
2003-10-02 09:55:53 jmedley [Reply | View]
I found the following log entries in access_log and am not sure what they are....
61.171.141.217 - - [02/Oct/2003:01:34:42 -0500] "GET http://www.sina.com.cn/ HTTP/1.1" 200 6962
61.171.141.217 - - [02/Oct/2003:02:23:21 -0500] "GET http://www.gov.tw/ HTTP/1.1" 200 6962
61.171.141.217 - - [02/Oct/2003:02:24:18 -0500] "GET http://www.google.com/ HTTP/1.1" 200 6962
61.171.141.217 - - [02/Oct/2003:02:25:44 -0500] "GET http://pubs.acs.org/journals/query/subscriberSearch.jsp HTTP/1.1" 404 314
61.171.141.217 - - [02/Oct/2003:02:27:40 -0500] "GET http://www.yahoo.com/ HTTP/1.1" 200 6962
Is someone going to other sites through my site?
Thanks,
JimM
-
questionable log entries
2003-12-14 14:41:20 anonymous2 [Reply | View]
No. From my experience, this does not mean you are an available open proxy: the 200 is misleading.
The response size is always 6962, which is most likely to be your homepage (check against normal homepage requests), the exception is the jsp file request, which is responding with a 404 due to journals/query/subscriberSearch.jsp not existing on _your_ server. If they had requested a file that did exist on your server, for example mylogo.gif this would have returned that file (tested this on my apache 2.0.48-win32 server).
Situation: your server is not being used as an open proxy and the request is being parsed so that http://xxx.xxx.etc/ becomes / returning files from your server, not the remotes as presumed.
This is happening to many, do a google on "GET http://www.yahoo.com/" to check out what others have to say. -
questionable log entries
2003-11-01 07:04:10 anonymous2 [Reply | View]
Indeed - it looks like you're running an open proxy on that server and whoever is at 61.171.141.217 has found it. www.yahoo.com seem to be a common test address in use for checking for open proxies.
If this access should not ba allowed (i.e. 61.171.141.217 is not an address you wish to proxy for) reconfigure your proxy server to return a 4xx (e.g. 404 or 403) error.
Example from my log:
64.222.176.130 - - [01/Nov/2003:14:32:00 +0000] "GET http://www.yahoo.com/ HTTP/1.1" 403 2898 "-" "Mozilla/4.0 (compatible; MSIE 4.01; Windows 95)"
Hope this helps,
Regards,
-->Gar
-
Directory directives not working
2003-09-04 10:17:58 anonymous2 [Reply | View]
I am running Apache 1.3.27 on Mac OS X Server v10.2.6 and would like to restrict access to a particular folder based on incoming IP number. In my httpd.conf file I added simply:
<Directory "/Library/WebServer/restrict">
Order Deny,Allow
Deny from All
</Directory>
and this restricts access to the "restrict" directory for everyone giving the Forbidden error page, as I would expect.
When I change the above to:
<Directory "/Library/WebServer/restrict">
Order Deny,Allow
Deny from All
Allow from 192.168.0 # IP number changed to protect the innocent--my intention would be to allow the entire 192.168.0.X domain in this example access to the restricted folder
</Directory>
However, Apache seems to ignore this Allow directive and I am again denied access from a machine on the 192.168.0.X domain.
The access_log says:
192.168.0.23 - - [04/Sep/2003:08:12:28 -0400] "GET /restrict/restrict.html HTTP/1.1" 403 321
The error_log says:
[Thu Sep 4 08:12:28 2003] [error] [client 192.168.0.23] client denied by server configuration: /Library/WebServer/restrict/restrict.html
I've also tried the Allow directive in the form:
Allow from 192.168.0.
I've also tried entering the Directory directive in the httpd_macosxserver.conf file--which gives the same results.
mod_access.so is being loaded.
Follow-up:
It appears that the Allow directive is working, although Apache doesn't appear to be checking it against the incoming user's IP number--it seems to be checking against the server's ip number.
For example, if I allow just one ip number:
Allow from 192.168.0.23
it denies access for the user 192.168.0.23
However, if I allow access for the SERVER'S IP number:
Allow from 192.168.0.20 # where .20 is the server's IP number, EVERYONE is granted access.
This is driving me crazy...
Any suggestions would be greatly appreciated.
-
Still not getting .shtml to work right.
2003-08-30 09:53:49 anonymous2 [Reply | View]
nice one! that did it
-
Re-Reading httpd.conf without restarting apache
2003-07-01 05:58:19 anonymous2 [Reply | View]
It is possible to make Apache re read the configuration file without stopping and restarting it - useful if you are not sitting in front of the machine.
Find out the process id of apache
cat /var/run/httpd.pid
then send a Hangup Signal to that process id
kill -HUP <id>
eg
[MyMAC:~] root# cat /var/run/httpd.pid
457
[MyMAC:~] root# kill -HUP 457
I believe that if there is an error in the file Apache will just keep running the old file, but don't quote me on that.
Alban
-
Finally got SSI to work! Here's what I ran into...
2003-05-19 17:41:01 anonymous2 [Reply | View]
I followed the directions exactly... I got the cgi-bin to work, was able to chmod and add .shtml to the default list (which was referenced to another article). However, when it came to getting the .shtml to having the cgi show up in the file, it didn't work (but the cgi worked fine seperate).
I found out the problem in the conf file was it was not set up as the tutorial. I did different searches and nothing came up. I eventually looked through the code, read the comments and found where I needed to add "Includes" (after many failed attempts at putting it in the wrong options list). Here is the snippet from the tutorial and below is where I found I needed to make the change...
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Actual httpd.conf file snippet:
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Library/WebServer/Documents">
#
# This may also be "None", "All", or any combination of "Indexes",
# "Includes", "FollowSymLinks", "ExecCGI", or "MultiViews".
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
Options Indexes FollowSymLinks MultiViews Includes
-
CGI write to file
2003-05-15 13:33:13 mmcleod1 [Reply | View]
I have a file named temp.txt
I read the contents of this file, but I cannpt append to it.
I cannot create a new text file either.
Is there a permission setting I need to change to allow my cgi script to write to a file?
-
Permissions Trouble
2003-05-11 21:10:33 anonymous2 [Reply | View]
I just tried following this command line input:
cd /Library/WebServer/CGI-Executables
chmod 755 test-cgi
in order to make my cgi scripts executable, however my terminal shell spit back:
"chmod: simplest.cgi: Operation not permitted"
I'm wondering if there are some other permissions I made have changed before that would cause this to happen. Any ideas? Thanks. -
Found the Answer
2003-05-12 12:09:48 anonymous2 [Reply | View]
Okay, I've found out how to do this. I'm not very competent with unix, but apparently, you can only do the chmod command if you're working from the root user folder or something. So, what you're supposed to do instead of:
chmod 755 (whatever file)
is
sudo chmod 755 (whatever file)
I don't really know what sudo is, but it seems like a progam that allows users to operate with root-like permissions for 5 minutes at a time, thus you can use sudo followed by any command every five minutes to keep it going. If anyone knows more about why this is necessary and what is really going on, please post. Thanks and good luck. -
Permissions Trouble
2003-05-11 23:25:44 anonymous2 [Reply | View]
Hey me too! How can I put a cgi-bin file in one of the web sites I am working on in my "Sites" folder?
I can't even get permission to work on the file because it says
chmod: test-cgi: Operation not permitted
Help!
So how do I fix this?
and how do I do something more complex like setting up /~user/Sites/www.website.com/cgi-bin even if it is just for my own testing purposes and I'm not serving to the web?
-
where is httpd.conf
2003-03-29 16:33:03 anonymous2 [Reply | View]
Struggling here after years with IIS! Why can't I change permissions on the test-cgi file? The server gives "operation not permitted".
am I completely thick, but I can't find the config file. I can't see the etc/httpd directory at all. I have admin permissions but not that familiar with Mac x on which this is running
-
Premature end of script headers
2003-03-21 06:41:28 anonymous2 [Reply | View]
When I excute any script I get a Internal Server Error. Looking at the logs shows Premature end of script headers does anyone know what this means? -
Premature end of script headers
2003-06-02 12:44:28 anonymous2 [Reply | View]
I had the same problem.
Make sure you have Unix line breaks.
Make sure the text is ASCII.
And (this is the one that hung me up, I'm ashamed to admit) make sure the perl script points to #!/usr/bin/perl
not #!/usr/local/bin/perl
Confirm this with whereis perl in the terminal
Good Luck
-
httpd.conf
2003-03-17 11:45:04 anonymous2 [Reply | View]
I tried to backup the httpd.conf and then sudo to access it (because I don't have bbedit) and its giving me a command not found message. I couldn't continue with the rest of the examples because it gave me access denied messages.
Advice anyone? -
httpd.conf
2003-03-28 01:29:36 anonymous2 [Reply | View]
if you do not have bbedit you can do one of two things.
One: dload bbedit 7.0.3 from http://barebones.com (free to demo)
or you can use a "pico" command
sudo pico /etc/httpd/httpd.conf
pico (as you will learn in later installments of the article) is a cli text editor. I think lesson 3 or 4 talks about pico. If not I know Learning terminal in jaguar (chris stone) talks about it.
-
still don't have permission to access /cgi-bin/ after using "chmod"
2003-01-12 01:04:56 anonymous2 [Reply | View]
in /library/webserver/cgi-executables/, I used sudo chmod 755 test-cgi to change the file permission. But, when I tried to load /cgi-bin/ in a web browser, I still get "You don't have permission to access /cgi-bin/ on this server."
I'd appreciate it any help. Thanks. -
still don't have permission to access /cgi-bin/ after using "chmod"
2003-04-19 12:00:45 anonymous2 [Reply | View]
I had that same problem. I had to login as the 'root' user make changes and then log back in as myself. I had to do the same thing for making changes to the httpd config file.
regards,
tom -
still don't have permission to access /cgi-bin/ after using "chmod"
2003-05-11 23:19:50 anonymous2 [Reply | View]
I've just come across this article, (May 2003) I'm running OS X 10.2.5 and for the life of me I can't get this working. I keep getting the same error
chmod: test-cgi: Operation not permitted
I'd like to learn how to set it up so that my users can have a folder in their directory called "cgi-bin" that will execute .cgi and .pl files (just like my ISP has)
I know nothing about unix, but I've followed the tutorial every step of the way and repeated it about 5 times now and I can't get it working. Is there anybody out there still reading this?
I tried to register but got a message telling me there was an 'internal server error' so I guess even O'Reilly has problems.
Thanks,
Matt
-
LoadModule command is not working...
2002-12-31 10:13:50 anonymous2 [Reply | View]
When I type:
LoadModule cgi_module libexec/httpd/mod_cgi.so
It says:
LoadModule: Command not found.
Did I miss a step? I've been doing fine with all the other steps up until this point. Thanks in advance,
Raymond
-
http-conf problems
2002-12-23 12:11:35 sweyhrich [Reply | View]
I worked my way through the article about setting up Apache on Mac OS X to run CGI files. The place that involves running the "test.cgi" file had different results on my system. Rather than a 403 error, I got a 404, file not found error. I changed the permissions of that file to 755, and still had the same results. The error message obtained by using the "tail" command on error_log returned this line:
[error] [client 127.0.0.1] script not found or unable to stat: /Library/WebServer/CGI-Executables/test.cgi
The end of the access_log reads:
127.0.0.1 - - [23/Dec/2002:13:51:31 -0600] "GET /cgi-bin/test.cgi HTTP/1.1" 404 290
I can't really morve forward on this excellent tutorial until I get past this problem. The settings that are supposed to be in the http-conf file (discussed earlier in the article) match what is supposed to be present.
Thanks,
Steven Weyhrich
-
odd access file????
2002-11-01 21:23:17 anonymous2 [Reply | View]
The access file had the server IP address as the first item. It seem the client IP address should be there. I guess it could have been the same.
-
no luck at all with SSI
2002-10-23 14:30:30 anonymous2 [Reply | View]
having a frustrating day. have been through many manuals, tutorials, and now your article to turn on SSI -but it still isn't working for me. is there some kind of gotcha that i'm missing out on.
with only 3 things to change - this shouldn't be that difficult. i set up a virtual host with no problem. any insight? -
no luck at all with SSI
2003-02-20 14:21:46 jkurson [Reply | View]
see if you made the same mistake i did...
follow the instructions in the article.. search for
/Library/WebServer/Documents in httpd.conf
and add the word Includes to the line that begins with "Options" is what the article seemed to say.
This is wrong.
a little farther down there is another line that is also
/Library/WebServer/Documents
and a little below that is another line that begins with "Option".
This line is where "Includes' should be added.
-
^M Problem Has A Simple Solution or Not?
2002-10-11 06:30:48 anonymous2 [Reply | View]
I developed hundreds of Perl scripts on my old Mac, but I always did it online. ALong comes OS X, which in theory should make offline Perl dev. simple for a novice like me. But when Macintosh Apache sees a Mac developed Perl script (SimpleText), it croaks because it sees ^M instead of a carriage return.
So I opened a test file in PICO, and one by one replaced each ^M with a unix carriage return... and poof... the script works. So now I'm searching for a simple way to convert my old SimpleText Perl scripts into Mac OS X Perl compatable ones. TextEdit will save a PICO written file in the write format, but saves SImpleText files with the ^M, and there is no toggle that I can find to tell it to get rid of the ^M and give me a mac unix version. This is frustration because I can't find a replace all command in PICO.
1) why does my unix virtual server that I pay $84 a month for read my old mac written Perl scripts without a hitch,
2) What do I have to do to convert my old Perl scripts so that Mac OS X Perl can read them???????
Jim -
^M Problem Has A Simple Solution or Not?
2002-11-28 07:09:24 yyyyy [Reply | View]
hi Jim
use bbedit. open your cgi file change the mod to unix save it. It should work now.
kutluhan -
Macintosh line returns in scripts (^M)
2003-02-17 11:00:04 kenv [Reply | View]
I happened to open my perlscript in vi and saw numerous ^M. I said to myself that must be the problem. So then I came here and saw this article. I changed my preferences in BBedit to UNIX line returns and Whala everything works fine. I couldn't figure it out for the longest time. Thanks
-
Messing with Python cgi...
2002-10-07 17:14:24 elmlish [Reply | View]
First I want to thank you for the great article. It's been very helpful, but since I'm trying to be an oddball and use python for my cgi's I'm having some trouble. I've gotten your examples to work, but as you'll see I'm getting an error I don't know what to do with.
I've got most of everything set up correctly (I think..)but I'm getting this error when I try to access my script via an .html file.
[Mon Oct 7 16:47:21 2002] [error] [client 127.0.0.1] Premature end of script headers: /Users/iz/Sites/py-cgi/cgitest.py
What would cause this? I'm using this same script on my hosted server, and it works fine there.. I must be missing something
Thanks for any help..Keep up the great articles...
~elmlish~
-
cgi's in sites dir
2002-10-03 07:28:02 dragonfly1 [Reply | View]
I'm trying to run some cgi-scripts from a user directory sites/cgi-bin and i ScriptAlias'ed this dir. All the permissions are set well and the scripts execute fine from the shell but when accesed from the web the scripts are accessed rather then executed. It looks like perl is not found.
Anyone any idea how to change this?
thanks !
-
Custom cgi's not working
2002-10-01 21:28:43 ccalfee [Reply | View]
Alright, both of the built in CGI's worked but none of my custom ones that work on other machines are working. The browser displays an Internal Error 500 but the log shows 2 entries; No such file or directory and Premature end of script headers. any ideas?
-
Apache won't start after Include added
2002-09-24 12:15:52 anonymous2 [Reply | View]
Apache won't start up after I added the Include statement to the Options. This is what my line looks like: Indexes FollowSymLinks MultiViews Include.
And I get a
Syntax error on line 396 of /etc/httpd/httpd.conf:
Illegal option Include
/usr/sbin/apachectl start: httpd could not be started
Any ideas?
Thanks
-
To Morbus
2002-09-12 03:16:55 epvb [Reply | View]
Thank the goodness! I finally nutted out where I messed up - just started from the start.
Just wanted to say thanks for this tute - it's really cool - Let's see if I can get a promotion with my extended knowledge. ;-)
Nice surname bye the way, Mr Iff
E.
-
Still not getting .shtml to work right.
2002-08-26 09:17:21 oliverspapa [Reply | View]
I have gone through this article a dozen (literally) times and all of the suggestions in this discussion and *still* cannot get the .shtml to work properly.
If I target it specifically, it works, so I know that it is able to process SSI (correct?). The problem is, when I swap out the .html with the modified .shtml, I get the default Apache page with the "Not seeing the page you expected..." message.
What gives? I have dumped my cache (it is set to never cache and has 0MB assigned to the file). I have stopped and started Apache. I have made sure that I was adding 'Include' to the proper directory. I even went in to DirectoryIndex and added 'index.shtml' before 'index.html'! I really do not know where to go from here.
I have gone so far as to try editing the ...conf.default page; add 'Includes' to my user file; and any other outside option I ran across. I know this should not be as difficult as it is, but for whatever reason it is.
I am brand new to doing any of this, but what could I be missing? I even tested the .conf for errors and got the 'Syntax ok' approval.
Please offer any suggestion you may have. I will greatly and definitely appreciate them.
Regards,
Craig -
Still not getting .shtml to work right.
2002-09-25 16:45:04 philocon [Reply | View]
No chance to find the answer in the article. -
It's here:
Search for
'DirectoryIndex index.html'
add 'index.shtml'
so it reads
'DirectoryIndex index.html index.shtml'
For further explanation read
http://www.onlamp.com/pub/a/apache/2000/03/02/configuring_apache.html -
Getting .shtml to work right!
2006-06-22 05:24:21 carlco2 [Reply | View]
sudo pico /etc/httpd/httpd.conf
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.shtml default.html default.shtml index.php index.cgi
</IfModule>
that should get about any default page working.
-
Still not getting .shtml to work right.
2003-11-09 19:33:05 anonymous2 [Reply | View]
I certainly had the same error, but adding index.shtml didn't help. It works as 127.0.0.1/index.shtml (so the shtml reading must be activated) but when i load 127.0.0.1 it goes to the Apache default page. My DirectoryIndex change looks like so:
<IfModule mod_dir.c>
DirectoryIndex index.html index.shtml
</IfModule>
Any suggestions?
-
Again cgi-test
2002-08-15 08:02:03 pathell [Reply | View]
Hello,
I really do appreciate this training about Apache
As a non-English writer and an Apache beginner, I am a bit afraid to ask a question, anyway…
And I’ am very happy, because I found the answer to my problem
(CGI test script report doesn’t appear when running index.shtml)
by using the solution proposed by “philocon”
But I wonder why it is working, by just changing the serveradmin address?
Thanks a lot,
Now I’ am going to part 3
-
http://127.0.0.1/...plus index.shtml...needed?
2002-08-04 19:03:44 bobmoore [Reply | View]
I couldn't get http://127.0.0.1/ to work to bring up the SSI test, but the following did work:
http://127.0.0.1/index.shtml
...and I got the http://127.0.0.1/cgi-bin/test-cgi results.
-
ScriptAlias: Command not found.
2002-07-28 07:31:54 ferrit [Reply | View]
Hi,
When I try to call ScriptAlias from the Terminal I get a comand not found error (this also happens in bbedit) any ideas ?? (terminal info below)
Thanks,
Jon
[/Library/WebServer/CGI-Executables] jonadmin% ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"
ScriptAlias: Command not found.
[/Library/WebServer/CGI-Executables] jonadmin%
-
perl location
2002-06-21 14:26:15 bluesy [Reply | View]
One thing i missed in the article was a note telling that the perldirectory is /usr/bin/perl i had a huge time figuring this out since the test scripts is /bin/sh
Anyone know how to make you able to write both /usr/bin/perl and /usr/perl ?
Dennis
-
Can't see index.shtml page
2002-06-20 14:09:59 ltwiebe [Reply | View]
I've been having problems seeing my index.shtml page. I've read thru all the other problems on this, and have done everything (uncommented AddType, AddHandler, added Includes to /Library/WebServer/Documents and added index.shtml to DirectoryIndex
Any suggestions?
-
bbedit /etc/httpd/httpd.conf
2002-06-01 22:48:22 cmgarofalo [Reply | View]
i'm getting "bbedit, command not found" when i enter this command line. also tried simpletext /etc/httpd/httpd.conf
any ideas why this isn't working? all preceding steps worked out fine.
thanks!
-
bbedit /etc/httpd/httpd.conf
2002-06-20 14:17:44 ltwiebe [Reply | View]
If you want to run bbedit from Unix command line in OS X, you need to install a separate piece. I found it in the BBEdit Extras folder and is called BBEdit Unix Tools Installer.dmg.
-
Problems getting scripts running.
2002-05-01 17:09:33 cwdegidio [Reply | View]
I tried running my script using the information above, but I got the following:
Forbidden (etc, etc etc.)
I checked my error logs and this is what is said....
Options ExecCGI is off in this directory: /Users/shellyst/Sites/env.cgi
so whats wrong? -
Problems getting scripts running.
2002-05-07 05:03:25 david.parrish@buentec.com [Reply | View]
Hi:
The instructions in the article set-up the CGI-Executables directory under /Library/WebServer/ to execute CGIs.
To use your 'personal' web-serving space (that you refer to above), you need to follow the same set of instructions regarding ScriptAlias, but apply them to the directory under /Users/ that you want to execute the CGI from.
cheers,
-
problems with httpd.conf
2002-04-28 18:57:47 beefyt [Reply | View]
I was trying to get ScriptAlias to point to another directory with no luck. I eventually just tried to get an Alias to work and it still wouldn't. The point where I gave up is when I changed
Alias /icons/ "/usr/share/httpd/icons/"
to
Alias /banana/ "/usr/share/httpd/icons/"
saved, and closed. I then logged into http://127.0.0.1/icons/ and guess what, it loaded just fine. http://127.0.0.1/banana/ errored. The log file said
[Sun Apr 28 21:43:08 2002] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/banana/
which implies that the alias failed and it just looked for /banana/ in the default /Documents directory. So why didn't the alias work? Why doesn't Apache read my httpd.conf file!
When I invoke httpd -V it clearly says
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
yet changes I make to that file do not take effect. I am sure the changes are saved and the file is closed when I try to access it. Is Apache using a different config file? Please help me, I'm lost. -
ahh, fixed it
2002-04-28 19:13:46 beefyt [Reply | View]
So no one told me you had to restart the server. Anyone know how to reload the config file without restarting the machine? -
ahh, fixed it
2002-04-29 04:21:26 Kevin Hemenway |
[Reply | View]
"sudo apachectl stop" will stop the Apache webserver, and "sudo apachectl start" will start it up again. You can also do "sudo apachectl restart" which combines both a "stop" and "start".
-
acgi
2002-04-24 03:40:29 kkniel [Reply | View]
Love the articles. How do I copy an acgi into by cgi-bin directory. I am coming over from webten to Mac OS X server but of course I can't see these folders that I need to put the acgi application into.
Thanks -
acgi
2002-04-24 19:58:00 Kevin Hemenway |
[Reply | View]
There's been recent work in this area. You can find more at the VersionTracker page for "acgi dispatcher".
-
Kill Apache???
2002-04-22 07:58:47 jblarsen [Reply | View]
I made changes to httpd.conf that were incorrect, then stopped and tried to restart Apache from the System Preferences panel. When I tried to restart, the panel said "web server starting up" and sat there.
I could not figure out what state the startup was in, nor how to kill whatever process was preventing the startup. I did not see httpd in the process list. I eventually rebooted to clear the problem.
Was there another way to handle this situation without rebooting?
Jay -
Kill Apache???
2002-04-23 15:40:11 Kevin Hemenway |
[Reply | View]
You can restart Apache from the Terminal, but just with what you've described, I'm not entirely sure what the issue was. The Sharing SysPref will appear to stall when there's an error in your config file, so I'm assuming you had fixed that error before you tired to "stop and start" with the gooey button.
If this happens again, you can check that your config file is in good working order with "httpd -t" and then restart the server manually with "sudo apachectl start". Likewise, stopping the server can be done with "sudo apachectl stop".
-
Includes problem
2002-04-12 05:07:06 bernad [Reply | View]
I managed to get the first step done, but when i look for the <Directory "/Library/WebServer/Documents"> part, that's all there is. Not even a closing tag. Am I supposed to add all that because when I did, I tried to restart the server and it wouldn't.
-
Help Includes
2002-04-06 01:59:01 edo [Reply | View]
The Directory Documents in httpd.conf has an appendix: /Library/WebServer/Documents/manual
When i add the line "Incudes" the index.shtml is visable but not the test cgi-script. What to do?
I ran Apples latest security update on Apache. I'm using 10.1.3 .
-
Help Includes
2002-04-16 17:02:05 Kevin Hemenway |
[Reply | View]
I'm not sure I follow you. Could you give me some more detail?
-
PATH Environment Variable from printenv
2002-04-03 20:48:46 yaruki [Reply | View]
When I run the "printenv" CGI script from the main site folder, the PATH environment variable looks like:
"/usr/bin:/bin:/Users/shortname", where shortname is my short login name on that box.
Questions:
1) How is this path getting set?
2) What is this PATH, exactly? Is it a path that CGI scripts search for other executables? It doesn't seem to have anything to do with the URL request itself.
3) It seems like that last entry shouldn't be there, should it? Why or why not?
-
PATH Environment Variable from printenv
2002-04-16 17:00:20 Kevin Hemenway |
[Reply | View]
The PATH can roughly be stated as "anytime I run a program, I'll look for it in my PATH". So say, for example, that you write a perl script that uses the "grep" command. Because your PATH is set to /usr/bin OR /bin OR /Users/morbus, you can simply say "grep [command line flags]" in your perl script.
If, on the other hand, grep was not in either of those three directories, than you'd have to specify it's full path, like, for example: "/usr/local/sbin/grep [command line flags]". The PATH is set via environment variables - any time you log into the Terminal, a PATH is magically set. It allows you to say stuff like "perl myscript.pl" as opposed to "/usr/bin/perl/myscript..pl".
As for the /Users/morbus showing up in the path, it's pretty normal. PATH's automatically are defined with common directories (like /usr/bin and /bin), but very often, they define the current user's home directory as part of the PATH as well. It's nothing you'd really be worried about (although, you CAN override the PATH in your perl scripts - this will affect the perl script only, not the generic PATH of your webserver).
-
The CGI Basics....Please help
2002-03-28 16:11:48 beanie [Reply | View]
http://127.0.0.1/cgi-bin/test-cgi gets data OK.
http://127.0.0.1/cgi-bin/Hello.cgi gets:
"You don't have permission to access /cgi-bin/Hello.cgi on this server."
Permissions for CGI-Executables/Hello.cgi were set by chmod 755 and confirmed using Fetch 4.0.1.
I am Administrator............beanie
-
The CGI Basics....Please help
2003-03-29 16:30:37 anonymous2 [Reply | View]
Struggling here after years with IIS! Why can't I change permissions on the test-cgi file? The server gives "operation not permitted".
am I completely thick, but I can't find the config file. I can't see the etc/httpd directory at all. I have admin permissions but not that familiar with Mac x on which this is running -
The CGI Basics....Please help
2002-03-28 17:39:04 beanie [Reply | View]
I do not understand how "cgi-bin" becomes part of the paths when it does NOT exist.
beanie -
The CGI Basics....Please help
2002-04-16 16:55:07 Kevin Hemenway |
[Reply | View]
"cgi-bin'' is a special name that refers to the /Library/WebServer/CGI-Executables directory. If you're throwing your script in /Library/WebServer/cgi-bin/ then it will not work without further configuration tweaking.
-
test-cgi causes Internal Server Error
2002-03-27 22:17:29 tcolin [Reply | View]
Thanks for the helpful series.
I tried working through the steps in the article today, but ran into a problem with the execution of test-cgi. After chmodding as described, printenv worked fine, but test-cgi shows an "Internal Server Error" message in the browser, and puts the following error message in the log.
malformed header from script. Bad header=bootstrap_look_up() failed (ip: /Library/WebServer/CGI-Executables/test-cgi
Anyone wanna give me a clue?
BTW, running Mac OSX 10.1.3 Japanese on Quicksilver G4 733.
-
test-cgi causes Internal Server Error
2002-04-03 15:43:33 danastasi [Reply | View]
OK. I'm no expert, but here's an answer:
That error will only occur if you start apache while logged in to the terminal. Sometimes when starting a daemon from the terminal, OS X will "forget" who started it and/or where. This will happen with daemons other than Apache, too. I've had the same problem with MySQL.
One solution is to make sure that the Apache daemon is being launched on startup, not from the Terminal. -
test-cgi causes Internal Server Error
2002-04-06 14:27:33 scottfeldstein [Reply | View]
Had the same problem as above. "Internal server error" when loading a page with an include to "test-cgi."
Oddly, I changed the include to trigger "printenv" and it worked fine. It was really puzzling.
You already know the end of the story. I read the above comments and restarted my server. Works like a charm now. Thanks guys.
-
Why is chmod not permtted?
2002-03-25 15:55:38 beanie [Reply | View]
On page 1 of Part 2: I am stopped at the chmod line:
cd /Library/WebServer/CGI-Executables
chmod 755 test-cgi
Using the Terminal command line the directory is set but the chmod yields:
chmod: test-cgi: Operation not permitted
I have confirmed that a file, test-cgi, actually resides in the directory, CGI-Executables. My command line looks like this:
[localhost:/Library/WebServer/CGI-Executables] beanie% chmod 755 test-cgi
Beanie
-
Why is chmod not permtted?
2002-03-28 08:40:03 indigo [Reply | View]
I have the same problem...
Is it because my user is not allowed to perform this kind of operations? How to resolve this issue?
thanks. -
Why is chmod not permtted?
2002-03-27 16:40:43 beanie [Reply | View]
I'm getting desperate. I am the sole user. How can I get permission to set priveleges for file, test-cgi?
Beanie
-
retarting Apache...
2002-03-24 22:40:54 senecasax [Reply | View]
I wanted to do server side includes, so i followed your instructions.
I try to restart apache and it doesnt!
I type httpd -t and get the following:
Syntax error on line 2 of /etc/httpd/httpd.conf:
Invalid command 'd/mod_include.so', perhaps mis-spelled or defined by a module not included in the server configuration
What did i do wrong? the line in the file here looks like this:
LoadModule negotiation_module libexec/httpd/mod_negotiation.so
LoadModule includes_module libexec/httpd/mod_include.so
LoadModule autoindex_module libexec/httpd/mod_autoindex.so
What's wrong?
-
retarting Apache...
2002-03-25 08:24:23 senecasax [Reply | View]
I ended up just overwriting the httpd.conf file with its backup.. maybe emacs won't kill the file like word did... -
surely there's a better way?
2002-06-11 06:29:36 macette [Reply | View]
i got the same thing, and i could easily replace the apache file... but would prefer to know how to de-bug. (my error message was:
"virginia% sudo apachectl start
Syntax error on line 1 of /etc/httpd/httpd.conf:
Invalid command '/etc/httpd/httpd.conf', perhaps mis-spelled or defined by a module not included in the server configuration
/usr/sbin/apachectl start: httpd could not be started"
in the error log (am very new to this, so this is quite possibly totally irrelevant) it says:
"[Tue Jun 11 22:40:27 2002] [notice] caught SIGTERM, shutting down"
help? anybody?
-
thanks all
2002-03-23 12:42:08 greenfruit [Reply | View]
cheers, with the help of this article, comments here and http://www.cgi-factory.com i have managed to get a page counter on my site ;-) http://www.greenfruit.net
that was of course really just a test, any ideas on what else i can use cgi for?
-
CGI - ScriptAliasMatch
2002-03-11 13:00:22 kenyatta [Reply | View]
I was trying to figure out how to allow all my users /cgi-bin/ directories to permit cgi scripts. I came across the ScriptAliasMatch directive from the apache website.
There was a small tutorial that used pattern matching to catch /Users/(any user)/Sites/cgi-bin/(any script) I tested the printenv and test-cgi scripts from the /Library/WebServer/CGI-Executables/
-- the printenv script worked
-- but the test-cgi script gave me an Internal Server Error.
I checked the error_log, it said
"malformed header from script. Bad header=bootstrap_look_up() failed"
-- Anybody got a clue ?
I know that the printenv is a perl script, and test-cgi is a tcsh script, and all the permissions are fine.
-- I got the same error on a networked computer with 2 different users (1 is an administrator -although I doubt that matters)
----------------------------
ScriptAliasMatch ^/~([^/]*)/cgi-bin/(.*) /Users/$1/Sites/cgi-bin/$2
<Directory /Users/*/Sites/cgi-bin/>
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
-
CGI - ScriptAliasMatch
2002-03-11 17:05:32 Kevin Hemenway |
[Reply | View]
kenyatta, the error that you're seeing isn't related to what you're doing with the ScriptAliasMatch - the error seems to be pretty common (a number of other people have told me about it). I can't duplicate it, and I've never seen the error before. I haven't had the time to Google for an answer either.
Regardless, based on what you've got for ScriptAliasMatch, you should be all set for Perl scripts (I've yet to run across a production level tcsh script to run over CGI).
-
CGI script error
2002-02-28 11:37:05 fritz [Reply | View]
First let me say this is a Fantastic Tutorial. Thank you
When I enter http://127.0.0.1/ I was getting a directory listing, then I changed the "DirectoryIndex index.html" to "DirectoryIndex index.html index.shtml" and now I get the Gleefully served message with this below it.
[an error occurred while processing this directive]
I then changed the permissions of test-cgi to 755 and still get the same thing. ?
any thoughts?
Thanks again
Fritz
-
Domain Name
2002-03-01 11:11:16 fritz [Reply | View]
OK, in trying to figure out what is happening I am following the error_log and keep seeing the two following entries and am concfused. (not that that is all tha uncommon <grin>)
1)To Thu Feb 28 17:00:41 2002] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Thu Feb 28 17:00:41 2002] [notice] Apache/1.3.22 (Darwin) PHP/4.0.6 configured -- resuming normal operations
First, why is it unable to determine the FQDN?
I tried going into the file ~/etc/hostconfig, and changing the "HOSTNAME=-AUTOMATIC- " ( I have an DHCP DSL connection, not a static IP) but tried just the same to a name I own and is not used yet. NO Change. Is this the proper place to do that and if so how do I make it take effect so that I don't get the error listed above? Another note is that checking the output page of index.PHP shows host name as 127.0.01 regardless of this setting.
Also if you could comment on what the following means?
[Thu Feb 28 17:00:41 2002] [notice] Accept mutex: flock (Default: flock)
Thanks for a great series!
regards,
Fritz -
Domain Name
2003-04-05 10:09:44 anonymous2 [Reply | View]
This can actually be solved with the following steps:
1) Edit the httpd.conf file with an editor.
2) Search for the line that starts with ServerName
3) Change that line to ServerName <I.P. Address of your computer> (I run it on localhost so it is: ServerName 127.0.0.1)
4) If this line does not exists then add it in the httpd.conf file.
-
CHMOD from remote clients WSftp and FETCH
2002-02-25 20:00:21 loutti [Reply | View]
is there a way to do remote chmod using WSftp and/or fetch i keep getting an error stating that the server doesn't accept the command (503). I have many cgi scripts running but changing file permissions from the server is a drag.
-
not parsing in include
2002-02-15 11:23:49 bradrice [Reply | View]
If I do the SSI test-cgi include it doesn't parse in the document. If I run test-cgi from my browser it does parse. If I include it it in another shtml doc it doesn't. It does include, but only as a text document. What could that be?
-
with shtml I get an index of the contents of directory
2002-02-05 13:45:37 pablo2001 [Reply | View]
It seems I missed something. Thanks for the help. I've been raised on GUIs and this is all new to me. -
with shtml I get an index of the contents of directory
2002-02-06 07:42:53 Kevin Hemenway |
[Reply | View]
Nope, you didn't miss something. As the article is written, you would indeed get a directory listing after changing to index.shtml (or index.php for that matter). It's an oversight on my part - in testing/preparing the article personally, I had always added the filename onto the URL.
You can see how to fix this though, in Part 4, of the series. Look for something called DirectoryIndex.
-
how to enable .html
2002-02-05 12:35:04 storme [Reply | View]
I have headers and footers on all of my pages so I want to enable .html but it doesn't seem to work....
I put 'Includes' in my user config file and in the main httpd.conf file.
Some notes about my installation, I am not using CGIs. I am using Tomcat to serve .jsp pages (yes I have includes in these pages too) and have moved my root directory to:
DocumentRoot "/usr/local/jakarta-tomcat-4.0.1/webapps"
The error I get is: The requested URL /PCW/Index.html was not found on this server.
I have tried renaming Index.html to Index.shtml but no love.
-
how to enable .html
2002-02-05 13:19:10 Kevin Hemenway |
[Reply | View]
If you want .html files to be parsed for SSI's, then modify this line in your httpd.conf file:
AddHandler server-parsed .shtml
And make it:
AddHandler server-parsed .shtml .html
Then restart the server, and you should be set.
-
how to enable .html
2002-02-05 14:08:01 storme [Reply | View]
Didn't work....is it possible that the problem is that Apache is passing these pages onto tomcat? I should also note that since I am not using CGI I did NOT follow the CGI steps earlier. Here are what I *think* the important config lines that I've modified:
RewriteEngine on
RewriteRule ^/(.*)$ /PCW/$1 [R]
ServerName localhost
DocumentRoot "/usr/local/jakarta-tomcat-4.0.1/webapps/PCW/"
<Directory />
Options Includes FollowSymLinks
AllowOverride None
</Directory>
<Directory "/usr/local/jakarta-tomcat-4.0.1/webapps/PCW/">
Options Includes Indexes FollowSymLinks MultiViews
*** This is unchanged:
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
*** These are the Tomcat config lines:
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
WebAppConnection PCWConn warp localhost:8008
WebAppDeploy PCW PCWConn /PCW/
*** my users config files include the following:
<Directory "/Users/storme/Sites/">
Options Includes Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/usr/local/jakarta-tomcat-4.0.1/webapps/PCW/">
Options Includes Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/webserve/Sites/">
Options Includes Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
-
how to enable .html
2002-02-06 07:49:36 Kevin Hemenway |
[Reply | View]
I've not used Tomcat before, so I can't shed any insight on whether Tomcat is doing any of the processing.
Where is this "index.html" page that you want to load? I ask because in your first message, you mention that you set the DocumentRoot to /webapps/, so I was assuming you had an index.html in there. But, with the above configuration, anything in /webapps/ is autoredirected to /webapps/PCW/ with these lines:
RewriteEngine on
RewriteRule ^/(.*)$ /PCW/$1 [R]
If that's your intention - is there a /webapps/PCW/index.html in there? -
how to enable .html
2002-02-06 08:49:23 storme [Reply | View]
Yes. Everything works until I enable the lines:
AddType text/html .html
AddHandler server-parsed .html
which produces the error I mentioned above. Tomcat is supposed to serve any page with a .jsp suffix and Apache anything with .html so I wouldn't think that Tomcat has anything to do with it in this case but thought I should mention it. Note that since I'm not using CGIs (I think!) I didn't follow the CGI steps earlier in the article - a problem do you think? -
how to enable .html
2002-02-06 13:13:40 Kevin Hemenway |
[Reply | View]
No, not following the CGI instructions would have nothing to do with it. Instead of doing the two lines you just gave me, why not just modify your existing AddHandler line to include .html? So, instead of the above, search for your:
AddHandler server-parsed .shtml
And change to:
AddHandler server-parsed .shtml .html
-
Internal Server Error
2002-02-02 11:45:00 rtevans [Reply | View]
I get the Internal Server Error when I set my browser to http://127.0.0.1/cgi-bin/test-cgi
/var/log/httpd/error_log provides the following message.
[Sat Feb 2 13:49:58 2002] [error] [client 127.0.0.1] malformed header from script. Bad header=bootstrap_look_up() failed (ip: /Library/WebServer/CGI-Executables/test-cgi
I am running
Server version: Apache/1.3.22 (Darwin) on Mac OS X 10.1.2
I have not made any changes to test-cgi.
Excited about the web-server possibilties, but confused about this stumbling block. Any help is appeciated.
-
Internal Server Error
2002-02-03 13:36:58 Kevin Hemenway |
[Reply | View]
That's a new one to me. I know what the error message means ("bad header"), but not where that "bootstap_look_up" is coming from. There's another CGI script within that same directory called "printenv". Can you run that one at all? Does it give you the same error message? If you edit the test-cgi script, do you see anything in there about bootstrap_look_up? -
Internal Server Error
2002-02-19 18:03:22 pbates [Reply | View]
I too get this error. Printenv runs fine. I don't see anything about "bootstrap_look_up" in the test-cgi file. Here is the text of the test-cgi file:
Thanks.
Pete Bates
#!/bin/sh
# disable filename globbing
set -f
echo Content-type: text/plain
echo
echo CGI/1.0 test script report:
echo
echo argc is $#. argv is "$*".
echo
echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo REQUEST_METHOD = $REQUEST_METHOD
echo HTTP_ACCEPT = "$HTTP_ACCEPT"
echo PATH_INFO = "$PATH_INFO"
echo PATH_TRANSLATED = "$PATH_TRANSLATED"
echo SCRIPT_NAME = "$SCRIPT_NAME"
echo QUERY_STRING = "$QUERY_STRING"
echo REMOTE_HOST = $REMOTE_HOST
echo REMOTE_ADDR = $REMOTE_ADDR
echo REMOTE_USER = $REMOTE_USER
echo AUTH_TYPE = $AUTH_TYPE
echo CONTENT_TYPE = $CONTENT_TYPE
echo CONTENT_LENGTH = $CONTENT_LENGTH -
Internal Server Error
2002-03-03 07:20:56 philocon [Reply | View]
Same problem, same error messages, printenv works fine ...
Everything worked fine from the end of 2001 up to now. And now this!
-
Internal Server Error
2002-03-03 14:50:55 philocon [Reply | View]
Problem "solved".
I took a look at System Preferences' Network panel . Strange things must have been going on there. My IP address was 555.555.555.555 etc etc. So I simply restarted my machine, and everything worked fine again, except for this: In the window's title bar, it still says: 500 Internal Server Error.
Although I don't understand these things very well, I very much enjoy the articles about Web-Serving.
-
Internal Server Error
2002-04-03 15:46:52 danastasi [Reply | View]
Your problem seems to have been solved only because you restarted your machine. But, it may crop up again. I just replied to someone else's post about this, so here it is...
That error will only occur if you start apache while logged in to the terminal. Sometimes when starting a daemon from the terminal, OS X will "forget" who started it and/or where. This will happen with daemons other than Apache, too. I've had the same problem with MySQL.
One solution is to make sure that the Apache daemon is being launched on startup, not from the Terminal.
-
cgi outside of cgi-bin
2002-02-01 20:36:16 griffitts [Reply | View]
What are the security issues concerning use of cgi outside the cgi-bin? Is it a question of corralling multiple users of one server or does it involve protection from outside hacks? -
cgi outside of cgi-bin
2002-02-03 13:30:45 Kevin Hemenway |
[Reply | View]
It's a little of both. From an ISPs point of view, allowing any user to run programs on a web server, by request, is dangerous. Not only can the ISP not certify the security of these programs (without actually examining and understanding the code itself), but they also can't tell if the programs are well written - bad ones could cause infinite loops, take up lots of memory, and so forth.
From a user point of view, oftentimes, CGI scripts need to have special permissions on data files, so that the CGI script can read AND write to and from that file. These permissions often are 666 (which means "let everyone in the world read and write to this file"). If I hated you, for example, I could write a CGI script in my directory that could modify and mess with a data file in your directory, which of course, is not good.
Confining CGI scripts to a certain directory like /cgi-bin/ gives perk benefits - no one can view the contents of that directory from the web, for example, likewise making it harder to see secretive data contained within that directory. That protection doesn't happen if you can run scripts everywhere.
-
Server Admin
2002-02-01 11:21:55 galt606 [Reply | View]
First I would like to say that these are great and I am learning a lot from them. However, and this may be the wrong forum, how does this compare to OS X Server? Should I be following these steps in Server also? There are ways to access these things through the GUI, is that what you would recommend? The reason I'm concerned is because /etc/httpd has both an httpd.conf file and httpd_macosxserver.conf file. I don't know which it uses. Thanks for these, and any info about this. -
Server Admin
2002-02-03 13:23:46 Kevin Hemenway |
[Reply | View]
I've never used OS X Server, but from what I can tell, one of the "benefits" is that it comes with GUI configuration tools, which save you from learning all the commands and editing tricks yourself.
As for which config file it uses, you can find out what DEFAULT file it will use by issuing a httpd -V on the command line. You'll see an entry in there about SERVER_CONFIG_FILE. Note that this can be overwritten on the command line (ie. you could say httpd -c /etc/httpd/httpd_macosxserver.conf) to start up with that file instead of the builtin default.
One simple way of finding out which one is used is simply to make some changes in the GUI configuration, save those changes, and then check the modification date of each file to see which has changed.
-
Changing cgi permissions...
2002-01-31 22:18:51 razzlemfdazzle [Reply | View]
When i type this
tail /var/log/httpd/error_log
I get this
[Thu Jan 31 23:00:56 2002] [error] [client 127.0.0.1] attempt to invoke directory as script: /Library/WebServer/CGI-Executables
What am I doing wrong? -
Changing cgi permissions...
2002-02-01 07:18:25 Kevin Hemenway |
[Reply | View]
Depends. What URL do you type in that causes that error message? Have you changed any portions of your Apache configuration file?
-
My cgi's don't work!
2002-01-31 11:55:19 haymaker [Reply | View]
Every time I try to access a cgi, I get this message in the error log, "Premature end of script headers: /Library/WebServer/CGI-Executables/filename.cgi."
What am I doing wrong? -
My cgi's don't work!
2002-01-31 14:37:30 Kevin Hemenway |
[Reply | View]
That could be a ton of things, none of which is related to your Apache setup, or your CGI configuration. This filename.cgi script could have incorrect newline encoding, could not output the proper Content-type header, could have invalid syntax, or any of a number of other things.
I'd have to see the script itself to give you more information. How did you make the script? -
My cgi's don't work!
2002-01-31 17:20:02 haymaker [Reply | View]
I downloaded it from one of those websites that have free cgi scripts for download. I just wanted to see if my cgi-bin was working correctly. The test-cgi works okay, but so far, nothing that I put in there with a .cgi or .pl works. Which brings up another question - why doesn't the test-cgi have a file extension? Should I be taking the file extensions off the other files? -
My cgi's don't work!
2002-05-29 13:04:11 emc^2 [Reply | View]
I have the same msg and I can't fix it. Could you tell me how you did?
thx!
Emc^2 -
My cgi's don't work!
2002-02-01 07:08:58 Kevin Hemenway |
[Reply | View]
haymaker, your best bet is to start looking around for CGI FAQs, and "common things that can go wrong". Your Apache CGI configuration is working correctly, since the test-cgi runs correctly. In this case, file extensions don't matter. You're probably running into one of the problems I described in my previous post.
A quick way to test if a script has the right line encoding, for example, is to open the script up in the terminal, and see what you see. If you do:
less filename.cgi
And see everything on one line, or else a lot of ^M's all over the place, then you've got incorrect line feeds that will need to be converted to Unix ones.
-
Question!
2002-01-30 18:10:04 ganesha [Reply | View]
I followed precise yours instructions, but I dosn't work as I like; If I log on the localhost, I get a Browserwindow with the contents:
+----------------------------------------------------+
Index of/
Name . .. . .. . . . .. .
Parent.....
index.shtml .. . .. . .. .. . . .. . .. .
*------------------------------------------------------*
why it doesn't load the site index.shtml directly? If I'm changing the site into a normal .html-file, it works properly
it might be, that I didn't understand all of your advices; if so, please excuse my inpassion
thanks as lot - your documentation is REALY, REALY usefull!!!!!!
-
httpd.conf owned by root
2002-01-28 23:08:06 tanderson4 [Reply | View]
Using BBEdit Lite 6.1, I'm told that the file can't be unlocked because it is owned by root. When I check the permissions on the file, I see that the wheel group has read only access. Is there something obvious I'm missing here to be able to edit the httpd.conf file without having to log-in as the root user? I am logged in as an admin user.
Thanks for a great series of articles! -
httpd.conf owned by root
2002-01-29 10:31:49 Kevin Hemenway |
[Reply | View]
Hey there. You may want to look into BBEdit 6.5 - when you try saving a file that is not owned by yourself, BBEdit 6.5 will bring up a dialog asking for a valid password. It's transparent authentication.
Ignoring the above, no, you don't have to login as root to mess with the config file. What you want is something called 'sudo', which allows you to run commands as a different user.
You can find out more about 'sudo' in the Terminal: Part 1 article, also at O'Reilly. Check it out here: http://www.oreillynet.com/pub/a/mac/2001/12/14/terminal_one.html -
httpd.conf owned by root
2002-01-29 16:09:22 tanderson4 [Reply | View]
Thanks. I know about running sudo from the terminal window, and I guess that would allow me to edit the file using a terminal editor like emacs or vi. Using sudo doesn't extend privileges outside of the terminal session, does it? (I have lots to learn about the Unix side of OS X!) I actually have BBEdit 6.5 on order. I'll download the demo version until the real version arrives and give it another try. Thanks for the feedback.
-
missing lines in httpd.conf
2002-01-28 13:56:18 gvanmete [Reply | View]
I do not have these lines in my hpptd.conf:
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
where should I add them?
in addition, I was trying to install perl_mod as per the technotes at http://developer.apple.com/internet/macosx/perl.html and it instructs one to add these lines after installing mod_perl (using CPAN):
<Files *.pl>
SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options ExecCGI
</Files>
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache::Status
order deny,allow
deny from all
allow from mydomain.com
</Location>
do these lines need to fall within a specific section of httpd.conf? -
missing lines in httpd.conf
2002-01-28 18:08:57 Kevin Hemenway |
[Reply | View]
You should have a line that says <Directory /Library/WebServer/ (etc)/> SOMEWHERE in your httpd.conf - it doesn't have to be exactly the same. The instructions assume you're using the Apple supplied Apache, so if you're using one built from Fink or so forth, the specifics may be a bit different.
If you can't find anything similar, do a search for "Directory" and tell me all the instances that you find.
As for your mod_perl questions, no, they don't really need to be placed anywhere specific, but make sure they're outside any other containers (ie,. you wouldn't want to place them in a <Directory> container).
-
index.shtml not showing results of cgi script
2002-01-27 09:50:55 pattyb777 [Reply | View]
Thank you so much for this article - it is exactly what I needed! I'm learning Perl on Unix - didn't even know I had apache on my Mac! I am definately buying your book tomorrow.
I followed all the steps, but when I bring up index.shtml in the browser, it just says "Gleefully Served by Mac OS X" - no environmental info is printed. When I look at cgi-bin/test-cgi in the browser, it does show the environmental info.
I did enable cgi in the httpd.conf, and saved it. I turned off Web Sharing, and then turned it back on. I even managed to gain root access to do all this.
Am I missing something?
Patty -
I found another resolve
2002-02-15 19:54:28 orleck [Reply | View]
if you use bbedit or pico, go to /etc/httpd/users/
and then what ever your user is, you will find
that same line up as b4, just add "includes" to that file, and it should work, I had the same problem, but thats what I did. Tell me if it helps
patricko@eaglerockschool.org
Sincerely,
Patrick -
had same problem
2002-01-31 04:30:38 kevinmclean1 [Reply | View]
my problem was because I put "Includes" in the directory called only <Directory/>. I scrolled much further down in the file (through a bunch of comments) and found "<Directory "/Library/WebServer/Documents">" When I put the includes in there everything worked fine. Thanks for a great article.
Kevin -
index.shtml not showing results of cgi script
2002-01-28 11:12:36 Kevin Hemenway |
[Reply | View]
The actual feature that you're using that's failing is SSI's, so I would very carefully check over everything in the second page of the article to make sure things are all right.
When you reload the index.shtml page in the browser, and you don't see the CGI results, what do you see in a "view source"? If you see the SSI line I talked about including, then you've not got SSI turned on properly.
-
After editing html file
2002-01-20 14:47:18 panderson [Reply | View]
First I must also thank you for your tutorial. I have been looking around for just what you are doing here. Great stuff. I however am having the same problems after editing the index.html to index.shtml. I have read all the questions and answers so far but nothing has changed. I get a full directory listing of the
/Library/WebServer/Documents/ folder. When I enter 127.0.0.1/. I choose to read all the suggestions before I asked but still no luck.
Thanks ...........Phillip. -
After editing html file
2002-01-21 07:49:16 Kevin Hemenway |
[Reply | View]
This message didn't help you?
http://www.oreillynet.com/cs/user/view/cs_msg/5185
After changing your httpd.conf file as per that article, you'd need to stop and start Apache for the changes to go into effect. In a future article, I'll be going more indepth concerning the above change.
-
Error document
2002-01-16 06:45:36 martino [Reply | View]
As a non-developer I'm having a hard time making a 404 document. I gave up now. Are you planning to address this subject in the future? Maybe there's some kind of script or app that does this?
Martino -
Error document
2002-01-16 13:59:23 Kevin Hemenway |
[Reply | View]
Yup, I just finished the description and implementation of this for another article, to be published on O'Reilly. Be patient, grasshopper ;) ... -
Error document
2002-01-18 04:23:31 martino [Reply | View]
Cool. Because at this time, I can't make any files starting with a period, which is what this .htaccess has. When I try to change such a file, I first have to make it visible, but doing that with Filebuddy (invisible flag) doesn't have any effect on its visibility. Saving the file doesn't work either, Mac OS X will report an error, claiming these are for system use only.
Some clever programmer might be able to write a small program that goes around these restrictions that changes the server to use a error.html document in the root.
Martino -
Error document
2002-01-18 09:59:19 Kevin Hemenway |
[Reply | View]
Martino,
You can make and save .htaccess files, but you have to turn on "ShowAllFiles" in the finder.plist file (I think that's the one). I have all the "how to do it manually" info on a different machine, but you may want to look into software products like Tweaker and other similar utilities on versiontracker.com. If you want the manual info, email me at morbus@disobey.com.
With the setup I have now, I can see all files through my Finder view (including dot files) as well as save and edit them (assuming I have the right permissions). -
Error document
2002-01-25 12:14:06 haymaker [Reply | View]
I was having this problem too and realized that you have to be root in order to save a file witha "." at the beginning. Now I just create a file called htaccess (without the dot in front of it) with all the necessary information in it, and through the terminal type "sudo mv htaccess .htaccess" and it renames it with the dot in front of it. I don't know if that's the easiest solution, but it's been working for me.
-Chris
-
Adding another SSI Directory
2002-01-13 16:34:33 wmartino [Reply | View]
This series is amazing...exactly what I was looking for to learn about Apache!
I was able to get SSI working properly in the main webserver directory (/Library/WebServer) but had some trouble doing the same in my "Sites" folder. I added the following to my httpd.conf file, right below the other entry:
<Directory "/Users/william/Sites/">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Am I missing anything? Thanks for any help! -
Adding another SSI Directory
2002-01-14 13:02:42 Kevin Hemenway |
[Reply | View]
In this case, your configuration is being overridden by something not yet mentioned in the articles (and generically, relatively specific to OS X).
For each user that is created on your machine, you have a specific "users" configuration file for Apache. You can see these files by browsing in /etc/httpd/users/. You should see a configuration file named after your username (in this case 'william'). That's the file where you should add the "Indexes" Option for your personal Sites directory.
-
Directory listing, not .shtml file
2002-01-13 09:37:09 mab152 [Reply | View]
When I view http://127.0.0.1 in my browser I get a directory listing (not index.shtml, although it is listed), and when I update the files (added index.html, deleted index.shtml, etc.) the directory being served by Apache does not show the changes. Any ideas? Thanks in advance.
- Michael -
Directory listing, not .shtml file
2002-01-14 12:59:57 Kevin Hemenway |
[Reply | View]
Michael,
Your first question is covered here:
http://www.oreillynet.com/cs/user/view/cs_msg/5185
Your second question I'm not too sure about. I'm assuming you're refreshing your browser after you make those changes, and you've checked to make sure that your browser isn't caching the old results?
-
Problem enabling all .cgi or .pl files
2002-01-11 13:58:00 johnkoetsier [Reply | View]
hey, thanks for the article.
Since I'm just playing around on my own box, I want to enable all .cgi or .pl files to be executed by the webserver, wherever they happen to be.
I've uncommented the AddHandler for CGIs (see here:
# To use CGI scripts:
#
AddHandler cgi-script .cgi
)
but still get the Forbidden message when I try to access them.
Everything else you talked about worked for me.
Any suggestions? -
Problem enabling all .cgi or .pl files
2002-01-12 08:55:00 Kevin Hemenway |
[Reply | View]
When you try to run one of a scripts, what do you see in your error log after getting the message? -
Here's what the error_log says:
2002-01-14 15:03:50 johnkoetsier [Reply | View]
Message:
[Mon Jan 14 15:01:05 2002] [error] [client 127.0.0.1] Options ExecCGI is off in this directory: /Library/WebServer/Documents/helloWorld.cgi
Which basically tells us what we already knew ... I think. -
OK, fixed it ...
2002-01-14 15:13:15 johnkoetsier [Reply | View]
I added Exec/CGI to the options for:
<Directory "/Library/WebServer/Documents">
I guess it's a bit confusing, since there are a couple of things in httpd.conf that could be seen as overlapping, since I had already allowed CGIs anywhere by uncommenting this:
# AddHandler cgi-script .cgi
(or so I thought).
In any case, I am now up and happily (if insecurely) running. This is only a dev box for playing with, so I'm not too worried.
Thanks again for the article!
-
Includes for shtml
2002-01-10 14:45:24 walsh1 [Reply | View]
I had a questions about a statement you made on the bottom of page two of the “Apache Web Serving with Mac OS X: Part 2” tutorial.
You mention “For now, add the word Includes to the Options line.”
I was not clean on where exactly that line was to be added. Should it look like this:
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride None
Order allow,deny
Allow from all
</Directory> -
Includes for shtml
2002-01-11 04:24:39 Kevin Hemenway |
[Reply | View]
Yup, that's correct. The Includes can go anywhere on that line, as long as it's after "Options", so these are fine as well:
Options Includes Indexes FollowSymLinks MultiViews
Options Indexes FollowSymLinks Includes MultiViews
-
Still cannot access http://127.0.0.1/cgi-bin/test-cgi problems accessing
2002-01-08 11:20:41 eyelet [Reply | View]
After typing
cd /Library/WebServer/CGI-Executables then enter
then typing
chnod 755 test-cgi then enter
I get a message in terminal saying
chmod: test-cgi: Operation not permitted
Would you know, what I might be doing wrong
Thanks John
-
Still cannot access http://127.0.0.1/cgi-bin/test-cgi problems accessing
2002-01-08 14:35:59 Kevin Hemenway |
[Reply | View]
You must be a privileged user to do this - the instructions should have been more clear on that. Instead of doing "chmod 755 test-cgi", try doing "sudo chmod 755 test-cgi" - you'll be asked for a password, and you'll want to use an administrator password (if you're the only user on this OS X box, then use your Login password).
-
How do you open the config file with bbedit
2002-01-06 05:34:15 eyelet [Reply | View]
Hi
I just downloaded a demo version of bbedit how do I open the config file with bbedit, like it says in the article.
Thanks -
How do you open the config file with bbedit
2002-01-06 08:13:24 Kevin Hemenway |
[Reply | View]
By default, when you install the full or demo version of BBEdit, the shell utility is not installed automatically. To install this yourself, go to the directory where you installed BBEdit, and you should see a "BBEdit Extras" folder. Within that folder, you'll see a "BBEdit Unix Tools Installer", along with some instructions. Read through the instructions, run through the installer, and you should be all set.
-
Could we go a little deeper?
2002-01-02 14:08:30 beowulfrex [Reply | View]
I'm trying to control access to a sub-directory and I'm not having any luck getting Apache to pay any attention at all to .htaccess . Any suggestions? -
Could we go a little deeper?
2002-01-03 08:21:54 Kevin Hemenway |
[Reply | View]
We get into controlling access in the next article, which should be out sometime tomorrow or this weekend. We don't touch on .htaccess files at all, however.
-
This is great!
2001-12-28 13:02:18 jays [Reply | View]
I love this series! I can't wait until the next one! Thanks, Kevin!
-
Adding another directory. . . ?
2001-12-27 11:31:58 kenyatta [Reply | View]
Let's say I want to add another directory in addition to the /Library/WebServer/CGI- Executables directory? Let's say i want to add this directory:
/Users/Mike/Sites/cgi-bin
how would I add it? like this?? (this syntax works fine, but doesn't work... I don't want to uncomment the AddHandler line
#AddHandler cgi-script .cgi
---------------------------------------------------
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
<Directory "/Users/kniles/Sites/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
-
Adding another directory. . . ?
2001-12-27 12:17:35 Kevin Hemenway |
[Reply | View]
You're missing a key ingredient: "ScriptAlias", which tells Apache what files under what directories should be executed as CGI files.
ScriptAlias is crucial to use when you're not going to use the AddHandler directives. I'd modify your above <Directory> to:
ScriptAlias /cgi-bin/ "/Users/kniles/Sites/cgi-bin"
<Directory "/Users/kniles/Sites/cgi-bin">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory> -
Adding another directory. . . ?
2002-01-25 12:07:12 haymaker [Reply | View]
I was wondering how to do this too. Thanks!!
I'd also like to say how great this series has been - I knew absolutely NOTHING about apache or unix before reading these articles, and now I'm configuring my own web server! Thanks for making this stuff approachable.
-Chris
-
restarting Apache
2001-12-24 05:09:53 philocon [Reply | View]
My first experience with Apache Web-Serving was thrilling. -
But there is an annoying problem: After making changes to Apache's configurarion file I'm not able to restart Apache via the Sharing preference panel. I can stop it, but when I click "Start" again it says: "Web Sharing is being activated ... [Web Sharing wird aktiviert ...]." And that's it. -
Is somebody out there who can help me?
Many thanks in advance
Alban -
restarting Apache
2003-06-17 23:24:50 anonymous2 [Reply | View]
I can't seem to start Apache either. I ran httpd -t, and got no errors. Any other ideas? -
restarting Apache
2001-12-24 08:29:48 Kevin Hemenway |
[Reply | View]
Sounds like there are some errors in your modifications of the httpd.conf file. To have Apache test your configuration, enter your Terminal, and type the following:
httpd -t
If everything is dandy, you'll get a "Syntax OK". If everything isn't, then it should point you to the reasons why. -
restarting Apache
2001-12-25 13:10:56 philocon [Reply | View]
By entering "httpd -t" I get:
Syntax error on line 393 of /etc/httpd/httpd.conf: Invalid command 'Includes', perhaps mis-spelled or defined by a module not included in the server configuration.
What can I make of it? -
restarting Apache
2001-12-25 16:06:09 Kevin Hemenway |
[Reply | View]
Welp, if you could open the httpd.conf file and scroll down to that area, could you cut and paste what you see in there, so that I can take a look.
In my own httpd.conf, right around that area, I see:
Options Includes Indexes FollowSymLinks MultiViews
If, however, I incorrectly make that line:
Options
Includes Indexes FollowSymLinks MultiViews
Then I get the same error that you're seeing.
-
Lovin this too!
2001-12-20 19:27:36 ryentzer [Reply | View]
This is exactly what i was looking for since I have to build the company website and I want to show my evil PC coworker what macs can do. More more more....
-
/etc/httpd/httpd.conf "dosn't relate to your example - please help!"
2001-12-20 09:50:28 bob30 [Reply | View]
Fantastic article - at last a true platform to develop web sites in the mac!
The CGI access article chats about the "...rather large, but also well documented" config file... well mine isn't!! Here is a copy below:
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
Include /private/etc/httpd/users
So... the items "LoadModule cgi_module libexec/httpd/mod_cgi.so" and "AddModule mod_cgi.c" are not to be found - quote 'You'll see a number of these lines within the Apache config file.' HELP! I don't see them!
This is my first time here so please excuse my ignorance.
regards bob -
/etc/httpd/httpd.conf "dosn't relate to your example - please help!"
2001-12-20 10:12:27 Kevin Hemenway |
[Reply | View]
Hey Bob, how ya doing?
That's the *only* thing you see in your /etc/httpd/httpd.conf file? That's really odd. I've never run across that anywhere.
Could you do this for me? Open up a Terminal, type "cd /etc/httpd" and hit enter. Then type "ls -l" and tell me (or paste) what you see? Thanks. -
/etc/httpd/httpd.conf "dosn't relate to your example - please help!"
2001-12-20 10:24:42 bob30 [Reply | View]
Here's the output... many thanks...
httpd.conf
httpd.conf.bak
httpd.conf.default
magic
magic.default
mime.types
mime.types.default
users
I hope this helps?
bob -
/etc/httpd/httpd.conf "dosn't relate to your example - please help!"
2001-12-20 14:05:00 Kevin Hemenway |
[Reply | View]
Ah. I'm going out on a limb here, but you should see that the httpd.conf.default file is much larger in size than your current httpd.conf. If this is the case, take a look around for some of the lines that I describe in my article.
If you see then, then you may want to replace your current httpd.conf file with the default one. Only you can make that decision, of course.
To do so, make a backup of your current httpd.conf file:
cd /etc/httpd/
cp httpd.conf httpd.2001-12-20
And then replace it with the default:
cp httpd.conf.default httpd.conf
From there, try restarting the Apache webserver, and see what happens. -
/etc/httpd/httpd.conf "dosn't relate to your example - please help!"
2001-12-21 01:34:11 bob30 [Reply | View]
Thanks for the suggestion... the file, sadly, is rather similar to the original config file. Here it is...
#
#<VirtualHost *>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
Include /private/etc/httpd/users
What do you think? I'm off to check a friends machine who is running OS X to see what the file should like like.
Many thanks,
bob
-
still a bug
2001-12-18 19:59:30 chet [Reply | View]
% httpd -l
Compiled-in modules:
http_core.c
mod_so.c
suexec: disabled; invalid wrapper /usr/sbin/suexec -
still a bug
2001-12-19 07:47:26 Kevin Hemenway |
[Reply | View]
Chet, I'm not sure what you're getting at. This is a ... "normal" output from httpd -l. Suexec is something we won't touch on in these articles, but relates to user and file permissions on processes Apache runs (like CGI). Suexec doesn't affect SSI at all.
-
Not being processed
2001-12-18 13:29:50 radionerd [Reply | View]
I followed the excellent directions of this article and everything went as planned. I think created a brand new index.shtml file to put some commands into.
Since this article didn't mention any commands to try, I found this page:
http://apache-server.com/SSI/Appendix-C.html
I tried the following command:
<!--#printenv -->
And I get nothing. I do not get any error messages. If I vew the source of the page, I actually see the above comment.
I'd appreciate any suggestions. -
Not being processed
2001-12-19 07:44:43 Kevin Hemenway |
[Reply | View]
Hey there, RadioNerd. Glad you liked the article. Let's figure out what went wrong, eh? First things first - the article does mention a command to try. The very last code example on page 2 lists the HTML source of a SSI document, which would include the contents of the CGI script we tested on page 1.
As for the SSI not working, there could be a couple of reasons - did you restart the Apache webserver? Did you correctly uncomment the AddType and AddHandler lines in the config file (code snippet 1, page 2)? Did you correctly add Includes to the right directory (code snippet 2, page 2)?
-
Good stuff!
2001-12-18 01:41:59 chet [Reply | View]
Since the 1st article I've found that my odd
error messages could be solved by re-commenting
out the mod_perl lines.
Perhaps you could touch on when/whether such
commonly-used modules are needed in a subsequent
installment.
-
very helpful but...
2001-12-17 11:02:36 swatson [Reply | View]
I had couple of problems:
I couldn't open files from the terminal in bbedit (I have it on my machine) I had to use bbedits "open by filename" feature
when trying to access the access.log I couldn't. I browsed the directory and finally got the info from the access_log file
I couldn't chmod 755 the cgi directory I didn't have permissions (not logged in as root). I had to use the "sudo" feature I learned elsewhere on the site
the command from the terminal:
sudo chmod 755
gives you temporary root access and requires a password
Great tutorial though. I learned a lot. I just quadrupled my knowledge of apache. Thanks. -
very helpful but...
2001-12-17 13:42:39 Kevin Hemenway |
[Reply | View]
Swatson,
Thanks for the comments. By default, BBEdit 6.5 doesn't install the Unix shell command. You should be able to find an installer on the BBEdit 6.5 cd (or ESD) that will allow you to install the shell utilities.
What sort of error message did you get when you tried to tail the access_log?
-
very helpful but...
2001-12-17 23:04:27 cp21yos [Reply | View]
I've just gone back and checked my terminal (I worked through the article as I read it) and I was using the auto-complete function to fill out the path & file names so I didn't notice that it had filled out:
tail /var/log/httpd/access_log
If I list the directory you can see that an underscore is used...
[cto:~] cto% l /var/log/httpd/
total 8
-rw-r--r-- 1 root wheel 0 Nov 16 17:16 access_log
-rw-r--r-- 1 root wheel 4008 Dec 2 11:11 error_log
Great Articles by the way. -
very helpful but...
2001-12-17 19:37:13 swatson [Reply | View]
thanks for the bbedit tip works now.
the instructions say
"Apache's access file is located in /var/log/httpd/access.log. Let's look at the very last lines of that file, easily reached with this command:
tail /var/log/httpd/access.log"
when actually I had to use:
tail /var/log/httpd/access_log
-
something's missing
2001-12-16 22:56:43 ngb [Reply | View]
When I renamed index.html to index.shtml, the server no longer recognized it as the default page to load. Instead, I had to explicitly request index.shtml. Is there something missing in the instructions?
Thanks -
something's missing
2001-12-17 05:32:38 Kevin Hemenway |
[Reply | View]
Quite true. To modify and add to Apache's default page list, open your configuration file, and look for "DirectoryIndex". By default, it will just include "index.html". To support both, change it to:
DirectoryIndex index.html index.shtml
These are searched for in each directory *in order*. On my own personal installation, I use SSI's exclusively, so my index.shtml goes FIRST in that list. Again, doesn't make much difference for a smaller site, but if you're getting a boatload of hits a second, it's a minor improvement.






when i typed httpd -v, all i got was
Server version: Apache/1.3.41 (Darwin)
Server built: Feb 22 2008 09:40:56
and none of the below
-D SERVER_CONFIG_FILE="/etc/httpd/httpd.conf"
-D DEFAULT_XFERLOG="/var/log/httpd/access_log"
-D DEFAULT_ERRORLOG="/var/log/httpd/error_log"
will that affect the process that leads to test-cgi?