 |
 |
serving pages with os x
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status:
Offline
|
|
I enabled web sharing in the system preferences so that I could view websites stored on my computer. I'm not actually sure if I need this enabled when I just want to view them myself and not allow anyone else to view them, but I'll deal with that later.
My questions is about getting the perl scripts to excute. If I have the shebang line set to #!/usr/bin/perl, which is where perl is located, why are the scripts not executing. I know this is a fairly simple problem, but what is happening is that the actually script code is being displayed in the browser. I have already set the files to 755 so that the are excutable...what else do I need to do?
Also, I used relative links to link my pages together (i.e. = ../upadirectory.html). The pages are stored in the correct location, but whenever I attempt to use the link, the browser always says the file could not be found. I know why it can't be found...because the incorrect address is being opened, but I'm not sure why. It works just fine on a remote host, so if I just downloaded the files to my Powerbook, why are things breaking?
Thanks.
|
|
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
You need to put them into /Library/WebServer/CGI-Executables, then access them via http://localhost/cgi-bin (or of course you could edit your httpd.conf or create a .htaccess file which makes ExecCGI work in any directory, see the Apache docs for further information 
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Nov 1999
Status:
Offline
|
|
If you don't want others viewing your pages, then I would recommend firewalling Port 80 off from anyone other than yourself. Unfortunately OSX's built-in firewall configurator won't let you do this (it works on an all-or-nothing principle), but BrickHouse and other utilities will.
You can also use a .htaccess file to limit access only to you, but I wouldn't recommend this, because it returns an Error 403 (access forbidden) rather than refusing the connection outright. People will still know you have a server up and running, and that can be a Bad Thing.
|
|
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status:
Offline
|
|
Do I have to be connected to the internet to view pages locally? If I navigate to the 'sites' folder where the pages are stored, I am able to open the files individually. I am trying to set my machine up, however, so that I can type in an http:// address and access the website.
Could someone please guide me through getting this setup correctly. I have never dealt with webservers before and really have no clue what I am doing. I would like to be able to develop my pages (including cgi scripts!) and see how they look/function before placing them on to my remote server. Is this possible without being connected to the internet?
Thanks in advance.
|
|
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Feb 2002
Location: Fort Lauderdale, Florida
Status:
Offline
|
|
You can absolutely develop it locally. You can do the web page either in http://localhost/~username/ which would mean your html goes in /Users/username/sites/ or http://localhost/ and the html would be in /Library/Webserver/Documents. Not too confuse you, but actually you can develop the pages anywhere on the hard drive, but the above directories are the ones samba is set up to recognize.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status:
Offline
|
|
I type in http://localhost/~username and I get an error message saying that attempting to load 'XXXXX' failed. I think this worked at one point, but it was only when I was connected to my home wireless network.
I know I should get this part up and running successfully first, but what about cgi scripts?
|
|
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Feb 2002
Location: USA
Status:
Offline
|
|
I had to enable perl in my httpd.conf before I could get it to work. /etc/httpd/httpd.conf
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Oct 2000
Location: Washington, DC
Status:
Offline
|
|
Originally posted by milf:
I type in http://localhost/~username and I get an error message saying that attempting to load 'XXXXX' failed. I think this worked at one point, but it was only when I was connected to my home wireless network.
I know I should get this part up and running successfully first, but what about cgi scripts?
There's such a thing as putting the wagon before the horse, or however that quote went.
Get your webserver setup working first, because if it ain't working, then no cgi script will ever work.
If you really want to use cgi scripts, and you think you'll be the only user on the computer, then you should probably just try this:
http://localhost
See if that loads anything. If it does, then your apache install is installed and running fine. You would then use /Library/WebServer/Documents as your web server directory. You'd then put in your perl script stuff in /Library/WebServer/CGI-Executables, and you'd be able to access them by doing
http://localhost/cgi-bin/foo.pl
Or whatever it is your perl file is called.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Nov 1999
Status:
Offline
|
|
Some browsers don't seem to like "localhost" unless you're connected. I have no clue as to why that might be.
But there's another thing you can do. Try http://127.0.0.1 instead. This is a special IP address called loopback; when you use it, you're connected to your own computer. When "localhost" fails, this should still work.
|
|
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status:
Offline
|
|
That's the thing. I can't even get just the webserver up and running. I know at one point, I was able to type in http://localhost and have the Apache success page be displayed. That was last night. I was connected to my network. I'm not sure if that has anything to do with the success.
Once I do get the webserver up and running, I'd prefer to have not only Library/Webserver/... as the only place that I can have executables. I have my entire site contained in 'site/public_html/' with subdirectories and sub-subdirectories containing cgi-bin folders and scripts that need to be executable.
|
|
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Location: Washington, DC 20009
Status:
Offline
|
|
Thanks Millennium, the loopack address still works. I am using IE and I guess it doesn't like localhost when not connected to any type of network. The loopback address successfully pulls up the Apache page.
Now to get the cgi-bin stuff working. It still only displays the code.
Thanks.
|
|
Just my $.02 :-)
Ti Powerbook 1Ghz w/ Superdrive ......and lovin' it! :)
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Originally posted by Millennium:
[B]Some browsers don't seem to like "localhost" unless you're connected. I have no clue as to why that might be.
Because they try to be clever and assume that if you type in a one word address (eg blah) you really mean www.blah.com, or other such silliness.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|