Forum Moderators: travelin cat

Message Too Old, No Replies

storing your sites in other place

         

trismegisto

2:56 pm on Dec 28, 2002 (gmt 0)

10+ Year Member



I have an old imac, whose original 6gb hard drive I changed for a 40gb. To run os x I had to partition the hard drive in 3 (old g3 macs need to have os x in a less than 10gb hard disk), mac os x is running in a 3.5gb partition which now is almost full. I store my sites in a folder which is in another partition.

I’m upgrading all my static html sites to dynamic php/mysql sites and to test locally with my web server installed I have to store my sites in users > whateveruser > sites, or in library > webserver > documents, but as I said before, my os x drive doesn’t have the capacity to store my sites.

Is there a way in which I could store my sites in another partition and make them available for my web server which is in another partition? (I don’t think this can be possible), doing some kind of alias or something? I can’t even have my sites available if I place them in the os x’s partition but in another place different of users > whateveruser > sites, or library > webserver > documents. Maybe I could use andreas’ script [webmasterworld.com], but it would need to be suited specially for running on a mac, maybe with some applescript or something…

Any help will be very appreciated, thanks in advance.

BjarneDM

12:57 pm on Dec 29, 2002 (gmt 0)

10+ Year Member



It's (somewhat) easy: you've got to edit /etc/httpd/httpd.conf

!BUT! this is place is normally only visible in the terminal.
Now, do you have either of these installed:
-- TinkerTool
-- BBEdit 7

I can give you directions on how to proceed if you answer this question

yours in happy hacking
Bjarne - København ; Danmark ; Europa

trismegisto

3:16 pm on Dec 29, 2002 (gmt 0)

10+ Year Member



yeah, sure, i’ve installed BBEdit 7.

how should i do it?

BjarneDM

5:09 pm on Dec 29, 2002 (gmt 0)

10+ Year Member



You manually open a file. menu:File->Open... [apple]+O
At the bottom of the Open File dialogue box there's a box with the heading: Go to.
Into this you enter /etc/httpd/ and press the 'Go' button. You'll now have been taken to the otherwise hidden folder and will be able to select and open httpd.conf normally.

Once it has been opened, you'll have to onlock it for editing

Search the file for 'DocumentRoot'.
You'll have to change two lines to reflect the path to where you want your server to be placed. But notice that these file paths has to be in *Unix* terms. And as you want to serve your files from another volume, you'll have to prefix the normal file path as you can see it in the Finder with '/Volumes/'. Also, if you have any folder or file with a [space] in it, I advise you to remove or replace it. Unix systems aren't very fond of spaces in anywhere in a file path, but can handle it if absolutely necessary. Also notice, that Unix uses '/' as the delimiter in a file path while MacOS X Finder uses ':'. Also, Unix is very much case-sensitive, so be avare of your spelling. While you do have httpd.conf opened, take a look at it - it contains a lot of goodies, that you might want to experiment with at another time :-)

Save the file - you'll be promted for an administrator password.
Restart the web-server to make it notice it's new configuration - System Preferences->Sharing : stop web-sharing and start it again.

Any problems - please ask :-))

yours in happy hacking
Bjarne - København ; Danmark ; Europa

trismegisto

1:50 pm on Dec 31, 2002 (gmt 0)

10+ Year Member



ok bjarnemd, i did it, very cool!

i now changed apache. i tried to make SSI available but i couldn’t.

is there a way in which i could look for mistakes that maybe i had done unintentionally?

trismegisto

2:44 pm on Jan 1, 2003 (gmt 0)

10+ Year Member



mmmhhh, i couldn’t restart the server. when i opened sharing, web sharing was already off, when i switched it on, web sharing kept in “starting up”, but never really finished the start up. i’ve waited almost half an hour to see if it finishes the start up, but that never happens. the status is always “starting up”.

i suppose i made an error when i modified httpd.conf. i saved the original httpd.conf before making any mistakes, so i think if i rename httpd.conf copy to httpd.conf all will work again, but anyway i would like to correct my mistakes by hand and make the server work again.

is there a default configuration, so i can compare the dafault config with my httpd.conf and in that way find the irregularities?

BjarneDM

1:04 am on Jan 2, 2003 (gmt 0)

10+ Year Member



heyyyy! take it one step at a time :-))

Phew, you were sensible and made a copy before editing:-)
OK renaming and restoring the original httpd.conf ought to bring you back to ground zero

!FIRST! try to get Apache to serve your pages from another location before even thinking about doing anything else. Setting up another default folder is the easiest thing; doing everything else is somewhat of an arcane art! Do take heed of the warning at the start of httpd.conf and don't make any changes to this file unless you are 99.9% sure you'll get it right

!SECONDLY! try to implement one feature at a time, test that it's working, and the go on to the next great thing :-)

Testing whether your webserver is up and running is easy: open your web-browser and type [localhost...] or [127.0.0.1...] (they are synonymous) into the location-bar.

You can find a lot of great articles about the Apache on MacOS X here : [macdevcenter.com...]
[developer.apple.com...]
these sites contain!GREAT! and indispensable information on MacOS X. Even though MacOS X *is* a Unix based OS, Apple did make some changes, that makes it sufficiently different in some instances to make it a bit hard on novices.

Also, you have the whole Apache manual installed on your own HD at [localhost...]

As to enabling SSL : for each and every addtional module you want to activate, you need to 1) enable the module 2) load the module; which means that you'll have to at the very least un-comment two lines to make it work. Now, SSL in particular is the!last! thing I'ld try to enable on a webserver ;-)

There's a default configuration file included. Try the following:
1) start Terminal (the Unix commandline shell)
2) type : cd /etc/httpd ; ls -al
to restore the default configuration,
3) type : sudo cp httpd.conf.default httpd.conf
you can even start BBEdit from the Terminal
4) type : bbedit httpd.conf
to backup a modified version of httpd.conf
5) type : sudo cp httpd.conf httpd.conf.bak
from the terminal you can also see whether Apache is running
6) type : top -ll ¦ grep httpd
if Apache is running you ought to get at least 2 lines of output;
if Apache isn't running, you'll just get another command prompt
To (re)start Apache from the command line type : sudo apachectl graceful
If Apache won't start, try typing : tail -n 20 /var/log/httpd/error_log

As to finding the correct path to enter in httpd.conf from Terminal, do the following (assuming you want to serve from another partition/HD)
1) type : cd /Volumes ; ls -al
2) type : cd <HD/partition/folder-name> ; ls -al (no / in front of the name)
3) repeat 2) until you get a list of the contents of you webserver
4) type : pwd
the result of 4) is what you'll have to enter at the two places in httpd.conf mentioned previously. You can copy and paste from Terminal into BBEdit.

Now, if you want to be able to mess around in the Unix side of MacOS X from the friendly Finder, do install TinkerTool. This great little thing has amongst other things the option to make the finder show hidden files, and all System level Unix folders are normally hidden. Note, that you'll have to either restart the Finder from within TinkerTool or logout and then login again to make the change activate

I can give you a list of books I've found extremely helpfull, but I'm not sure at to whether posting the URLs to this information is allowed in here?

BjarneDM

2:12 am on Jan 2, 2003 (gmt 0)

10+ Year Member



Notes

Uppps misread SSI for SSL :-( SSI is the first additional thing I'ld implement, even though I've never myself used this feature; I just use the similiar function in BBEdit, but I maybe I should take a look at it, as my site originally was served from a server without this functionallity? Also, if you use SSI, you'll lack the possibility of looking at your site without running a webserver.

Beware: the forum changes a vertical un-broken line into a broken line. You'll find the correct character on the keyboard with [option]+I

When you use 'sudo' you'll often get prompted for a password. You'll just have to enter your own admin-password

trismegisto

2:59 pm on Jan 6, 2003 (gmt 0)

10+ Year Member



thank you very much bjarnemd, the informatin and links were very helpful. very appreciated.

apache is running again now, but i can’t make SSI to work (by the way, what is the SSL module? what does it does?)

i’ve seen in the apache documentation. in options i have to type ‘+Includes’.

Options +Includes

and then uncomment:


AddType text/html .shtml
AddHandler server-parsed .shtml

i’ve done it but didn’t work.

when i go to my files (they end in .shtml) in my webserver i just see plain code.

i changed apache’s options and now have these:


# 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 All MultiViews

i also tried this:


Options Indexes Includes FollowSymLinks ExecCGI MultiViews

and now instead of my code i see the page, but the side includes are not there.

what could be wrong?

BjarneDM

11:18 pm on Jan 6, 2003 (gmt 0)

10+ Year Member



It's hard to see what you are doing wrong without looking you over the shoulder :-) , but don't just rely on the apache documentation! One thing that comes to mind is that you write 'Options +includes' . Where did you put that bit of information? This seems to be the wrong way you've done this!?!

Now, as to the specifics, uncommenting the two lines is correct, but there's only one place you have to add 'Includes' to enable it for your whole website, and that's for the document root. Now, based on the default configuration - http.conf.default - the document root default configuration is done from line 384 through to line 409. You'll only need to make line 395 read
Options Includes Indexes FollowSymLinks MultiViews or
Options All MultiViews

Also, did you remember to restart Apache after having made your changes to httpd.conf? I've occasionallly failed to remember to do that, and was ripping my head out in frustration (possibly thats why I'm bald) until that omission hit me like a brick between the eyes ;-)

Please, do read the articles on MacDevCenter: there're 6 articles about configuring Apache - Apache Web-Serving with Mac OS X . Part two page two deals with SSI : [macdevcenter.com...]

If I understand your situation correctly, you are completely new as to serving your own pages. The best piece of advise I can give you is to read those 6 articles, following the instructions in them *exactly* and you should be home free :-) That's the way I learned most of what I know about the Apache WebServer: reading the articles on MacDevCenter starting with those, and then advancing to the more advanced ones. Please *don't* only rely on reading the comments in httpd.conf - admittedly they are great and necessary comments on the path to understanding Apache web serving, *but* they aren't sufficient. To *really* get an understading of things, you'll really need to read those articles - including the reader feedback. Additionally, I've read a book - [oreilly.com...] - to get a proper understanding of things. My needs might also be different from yours, as I was learning - and am still learning - how Apache works because I'm serving my site from my own computer over a 512/512 ADSL line.

As to the difference between SSI and SSL, SSI is (as you know) Server Side Includes. SSL is Secure Sockets Layer - cryptography for the web: that's what web shopping carts use to protect your credit card information etc and is indicated in you browser by that little lock icon being 'closed' as well as the URL starting with 'https' instead of 'http'.

BjarneDM

4:26 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



trismegisto --

How are things progressing?
Have you had any success or have you abandoned all hope?

Yours in happy hacking - Bjarne