I had gone back and forth between Apache 1.3.28 and 2.0 installations, staying stuck since too long with 1.3 version. Mainly because I use this webserver for business and it needs to remain available if I don't want to have business hickups. Although I have been installing and configuring so many instances of Apache web servers in the past (mostly on HP-UX and Linux) I am still intimidated when it comes to macs. Also I had tried multiple MacOSX Apache 2/MySQL/PHP bundles, and that didn't work for me, since that somehow conflicted with existing components. In fact as soon as we're back in the 100% GUI-driven syndrome, I don't get it. Wander in the internals.
Tonight I thought I should try it again. And I did. First I got Apache 2.0.52 package right from Apple website. I decided to deploy only what I needed to really upgrade, which would be Apache and PHP. Once well deployed and tested on separate port, I needed to have a couple of little things to set:
- PHP 5 load module - with a shiver about my existing code, developed in PHP 4. Same great Liyanage stuff, that guy's been around since a long time and still delivers great stuff. Little tweaks needed, but not that much.
- Name Virtual Hosts (see my other post on that)
- protected directories in my sites
- startup script (/Library/StartupItems)
- webserver user/group and privileges, session cache files permissions
- logs locations were changed
- Apache2 System Preference, which is quite nice to use (although I am a shell user by necessity)
I had absolutly no issue with the MySQL database connectivity, which is totally external to the Apache/PHP combo.
This upgrade was the oportunity to move from an old configuration file to a new one, since Apache 2 has its own specifics. There ares still litte details I didn't test yet, like some wap wml modules for cell phones, and my overal PHP 4 code.... Good thing is, the response is excellent; at least as good as my old Apache server.
I could have done it quicker, I guess. Overall it was completed in around two hours.
Thursday, December 22, 2005
Dynamic IP address & multiple websites with Apache
port forwarding

dyndns.org IP sending
Of course many of us know already dyndns.org website, which has been offering since years the possibility to get a domain name for free. For instance my private domain is theblackcat.dyndns.org. Since I don't have a static IP address at home, but the dynamic IP address provided by my dear ISP, I use dyndns.org. All I do is send to dyndns.org my IP address, on a regular basis. Uh in fact I used to, but since my router can do the job in my back, I let it handle it. I also tell it to handle wildcards so any subdomain will also be routed to me. More about that feature later...
I have Apache running on my G5. Nothing fancy, I tell my router to reroute all trafic coming on port 80, to my G5. So basically at this point I have a webserver behind a router, getting requests on port 80 for the default host, through a NAT router. Please note that in order to make sure that the port forwarding rule always works you will need to tell the router to associate the internal IP address 192.168.0.2 (in my example) to your web server's physical MAC address. If you don't do that and restart all your network, the NAT router will have all the bandwidth to address local addresses randomly, kinda first come first serverd. You don't want that. You need to harden the IP address of your web server, for the web services. If you have other components running on some other machines (say, a VNC service you need to access remotely) same rule, you'll need to give that other server a local IP address that doesn't change.
What happens when you hit: http://theblackcat.dyndns.org ? Dyndns.org name server tells your ISP where to route theblackcat.dyndns.org requests, and the router sends the requests on port 80 to that webserver behind it. Now, what if I don't have only this main family website, but also a myriad of other little web sites, on that machine?
Let's say I have customer XYZ to set up and test on my home server before putting the application on his/her ISP. My router will get these, I know that from a simple nslookup:
$ nslookup xyz.theblackcat.dyndns.org
Non-authoritative answer:
xyz.theblackcat.dyndns.org canonical name = theblackcat.dyndns.org.
Name: theblackcat.dyndns.org
Address: aa.bb.cc.dd
So it will work, the requests will be routed to my dynamic address and come to my computer. I will need to set a xyz.theblackcat.dyndns.org as a name virtual host in apache.
I will need to:
1) Activate the name virtual host in Apache:
NameVirtualHost 192.168.0.2
2) set this new virtual host by name
ServerName xyz.theblackcat.dyndns.org
DocumentRoot /path/to/xyz/document/root
3) Restart Apache web server. Voila! Http://xyz.theblackcat.dyndns.org requests will go through the internet to my router (dyndns.org IP address resolution), from the router to the computer (static route + port forwarding), and from the computer to the right subdomain document root (apache listener and name virtual host).
You can have many Name Virtual Hosts listening to the same IP address (my G5 IP address) and Port (80) and still it will work! In the past I used to route customers to different ports (ex: http://theblackcat.dyndns.org:789), but this way is much more secure and cleaner.
You could carry your laptop over the world, with all these nice websites sleeping inside, and still have your dyndns.org name following you. Still be online. You might need to add some little dyndns.org client to send the new IP addresses in the case you're not behind a nice NAT router which performs it for you, to have your IP Address sent. Either way, easy and reliable. Be aware that if your laptop is off, unplugged, people will get nasty looking TCP errors. You might want to use a cheap provider an set a little dynamic page to test your web server and tell user "Sorry - please come back soon!" -- That's easy, another story I'll tell you another day...
14 MacOSX essential applications
Of course when it comes to macs and great applications, I can't omit what Apple is giving us for free ( iTunes iPhoto iMovie iDVD Safari Mail)... There are also the sedentary 800 pounds gorrillas that I use all the time in my business and leisure, from Adobe (photoshop, illustrator, acrobat) and from Microsoft (Excel, Word, Powerpoint)...
Besides, here are the applications that I use, mainly from shareware or freeware origin. There are equivalent products out there, but at some point I decided to stick to these:
Besides, here are the applications that I use, mainly from shareware or freeware origin. There are equivalent products out there, but at some point I decided to stick to these:
- GraphicConverter: helped me hundreds of times in the past 10 years. It's still a reference in the Mac world
- Proteus (instant messenger on steroids, setting )
- iPulse: nice looking monitor for my G5, my favorite skin being "The Eye"
- Acquisition: cool peer to peer software, non invasive
- Launchbar: I know Tiger now has it. Launchbar must have saved me hundreds of hours
- Synchronize!Pro: I love this backup program
- Firefox: I use it a bit more than Safari. I merely use IE at all
- TextWrangler: best text editor for free. Little brother of BBedit
- HandBrake: to rip your DVDs
- MacJanitor: to cleanup your mac of the mess left behind; a healthy habit
- VLC: to play all kinds of movies files formats
- Transmit: to cover all my FTP needs. I never editi usually in a ftp utility. But with this one, when it comes to quick fixes or short release cycles, it's really great. Allows you to edit with your favorite text editor. Plenty of power tools (like synchronization) that I 'd rather NOT use :)
- FinderPop: sounds familiar? great Finder utility to map volumes from any place. Now ported on MacOSX. It's like meeting an old friend.
- DiskWarrior: I was about to forget this last one, although it's one of the best utilities to salvage disks and corrupted files structures. Succeeded where all others failed. A must!
What's in my MACOSX menu bar?
I have always been a fan of apple menus. In order of appearance we have (left from right):
- BackLight: an amazing desktop utility that allows us to play any ScreenSaver we have (like the great SaveHollywood which allows you to play movies as screen savers) - associating BackLight and SaveHollywood plays movies as desktop backgrounds. Added to that you can of course choose the opacity of the effects. Sweet!
- ByteController: very sweet iTunes controller. In fact the thing is, I merely use the menu bar options, mais I LOVE the keyboard shortcuts that allow me to control iTunes pause (cmd-alt-space), skip (cmd-right, cmd-left) and volume (cmd-up cmd-down arrows) buttons, while keeping on typing other things
- SpiritedAway: allowing me to hide idle application automatically and define exceptions
- Yahoo! Widget Engine: allowing me to have all my Yahoo! data (calendar, notes, address book...) directly on my desktop, keeping my data always up to date.
- GeekTool: listing on my desktop sets of logs when need be (nice to monitor a webserver, among other things)
- Stuffit icon (useful)
- Displays control panel (useful)
- Sound controller (useful)
- Applescript icon: to access library scripts quickly (merely used)
- Users menu: for quick switch
- MenuCalendarClock: great little utility; I use personnaly the freeware version which is realy enough for my usage
MacOSX sysctl.conf issue and resolution
Yesterday I decided to tweak my MacOSX (10.3.9) to supposedly speed up network transfers on my G5. I created /etc/sysctl.conf file and entered configuration based on some tip found on macoshints.com website to speed up Samba transfers. Not that I am unhappy with my setup, it's just I like to try new things and unleash hidden powers!
net.inet.tcp.mssdflt=1460
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
net.inet.udp.recvspace=74848
net.inet.udp.maxdgram=65535
net.inet.tcp.rfc1323=1
net.inet.tcp.newreno=1
net.inet.tcp.always_keepalive=1
net.inet.tcp.keepidle=3600
net.inet.tcp.keepintvl=150
net.inet.tcp.slowstart_flightsize=4
net.inet.tcp.strict_rfc1948=1
net.inet.tcp.delayed_ack=1
Indeed on MacOS if that /etc/sysctl.conf file is missing, since it's BSD distribution it's still looked at and picked up by /etc/rc bootup script, which sets all its data values using sysctl. Very powerful. So curious of this finding and excited by possible gain of speed, I went on and rebooted..... That's when the problem arised..... The system got sluggggiiiissssshhhhhhh. Started with network file server (NFS) load, till login screen ... that I never saw.....
Of course I had no bootup CD at hand, to undo my change. So much like me! I knew I had to to boot in Single User mode but I couldn't remember the bootup keys combination. So I felpt stuck, despaired, and angry at myself.
Lucky me I had another computer plugged in my router, to hook up to the internet! Kissed my Lucky Star... I could now boot and get the root prompt. I saw my /etc/sysctl.conf file, but there was no way to either delete it, or edit it! Sigh! The system complained that the system file was read only, but I was root with root privileges! A config file held by a process maybe? never heard of that before! It took me time, anger and more reading to figure that I needed to manually mount the volume in read/write mode. What I did. That was it! I could delete the culprit and reboot at blazing speed.
So what needed to happen:
- reboot computer in single user mode (press Command-s while booting)
- mount main volume in read/write mode (mount -uw /)
- remove /etc/sysctl.conf file (rm /etc/sysctl.conf)
- reboot
Here are the actions I felt at that time I should have taken before:
- print out / learn bootup commands
- burn a MACOSX bootup CD in case I need to jumpstart my G5 externally
- not simply change configurations unless really necessary and well understood, or a backup plan in place
- learn more about MacOSX bootup sequence. There's an excellent page on that.
- learn more about tcp/ip / kernel intricacies
Simple precautions. Computers are toys to toy with. But when they break we realize they are more than that. Now I feel more confident and will probably play around some more, once I feel comfortable.
net.inet.tcp.mssdflt=1460
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
net.inet.udp.recvspace=74848
net.inet.udp.maxdgram=65535
net.inet.tcp.rfc1323=1
net.inet.tcp.newreno=1
net.inet.tcp.always_keepalive=1
net.inet.tcp.keepidle=3600
net.inet.tcp.keepintvl=150
net.inet.tcp.slowstart_flightsize=4
net.inet.tcp.strict_rfc1948=1
net.inet.tcp.delayed_ack=1
Indeed on MacOS if that /etc/sysctl.conf file is missing, since it's BSD distribution it's still looked at and picked up by /etc/rc bootup script, which sets all its data values using sysctl. Very powerful. So curious of this finding and excited by possible gain of speed, I went on and rebooted..... That's when the problem arised..... The system got sluggggiiiissssshhhhhhh. Started with network file server (NFS) load, till login screen ... that I never saw.....
Of course I had no bootup CD at hand, to undo my change. So much like me! I knew I had to to boot in Single User mode but I couldn't remember the bootup keys combination. So I felpt stuck, despaired, and angry at myself.
Lucky me I had another computer plugged in my router, to hook up to the internet! Kissed my Lucky Star... I could now boot and get the root prompt. I saw my /etc/sysctl.conf file, but there was no way to either delete it, or edit it! Sigh! The system complained that the system file was read only, but I was root with root privileges! A config file held by a process maybe? never heard of that before! It took me time, anger and more reading to figure that I needed to manually mount the volume in read/write mode. What I did. That was it! I could delete the culprit and reboot at blazing speed.
So what needed to happen:
- reboot computer in single user mode (press Command-s while booting)
- mount main volume in read/write mode (mount -uw /)
- remove /etc/sysctl.conf file (rm /etc/sysctl.conf)
- reboot
Here are the actions I felt at that time I should have taken before:
- print out / learn bootup commands
- burn a MACOSX bootup CD in case I need to jumpstart my G5 externally
- not simply change configurations unless really necessary and well understood, or a backup plan in place
- learn more about MacOSX bootup sequence. There's an excellent page on that.
- learn more about tcp/ip / kernel intricacies
Simple precautions. Computers are toys to toy with. But when they break we realize they are more than that. Now I feel more confident and will probably play around some more, once I feel comfortable.
The portable desktop
I have always wanted to carry my desktop wherever I go. But without PDAs or a stuffed wallet. PDA's looked cool during the www bubble, but hey, most of us went back to basic necessities.... I want to be able to travel light and free, but yet carry my essentials with me: a piece of shell script I wrote, some login information, some bookmark, many things... Well, there is finally a major breakthrough, after walking in the desert for so long and talking to demons: the Yahoo Widgets! I hear you already: widgets arent't new! we have everything! we have Tiger! We have it all! Uh ... no, not really. There's always an invisible ombilical cord that ties us to a machine. And when this machine is away or simply dies, we die too.
Well, I hadn't given up. Experience and patience paid off. I tried many things many times. As a mac user for instance I could synchronize my Yahoo calendar / notepad / address book with my MS Outlook, and my PDA. After weeks of synchronizations, after multiple overwrites, multiple duplications, deletions, multiple purchases of utilities which would supposedly simplify --- I gave up. Till now. Finally again, I have Yahoo Widgets. I carry my desktop with me wherever I go, wherever I have the Widgets installed. I just need to enter my login information and get the widgets updated w/ my latest information (my calendar, my notes, my address book, my to-do's). I can see and edit my information, in one only place.
Okay I was lucky. I have a Yahoo/SBC account that I have been using in years. So I am specific, still. But the point that I am trying to demonstrate is, we are all moving towards a seemless portable desktop. A fluid access to our information.
Another revelation was del.icio.us bookmarks, very recently. There's been tons of things written on it, really a lot of buzz. A blog convinced me to go over the so-simple (ugly?) user interface and try to finally use it. Once passed the first mitigated impression, you start building your bookmarks and keywords. By clicking around you discover others and their keywords and bookmarks. That's that social bookmarking! What a great and simple idea! Now, you are carrying your bookmarks around with you, you also have them categorized in a very special way that works for you. You are also discovering new places of value on the web! Right there a click away. We all use Google, but del.icio.us is different from raw - yes possibly elaborate - search. This is your own repository of information. You can crawl del.icio.us by key word and get to some very pertinent information, without any Googling.
You can also have del.icio.us work for you by setting some inbox key words and wait for it to suggest new findings based on these words...... Not finding over zillions of web cached pages, but over bookmarks that people considered of value. That's a human filter. By making your lists available to others, you also share your discoveries. Or advertise for yourself by inducing the Buzz. Read "The Several Habits of Wildly Successful del.icio.us Users" from Slacker Manager, for additional thoughts.
Another little habit that became tremendously important for me, has been to gather all my RSS feeds online, with Bloglines.... I tried alternatives before and after Bloglines, bought some newsreader for my mac: NetNewsWire, said to be the best of its kind on mac. Since I have multiple computers to use, again, I was in the maze of syncs that would not really work.
The combination of these three tools today brings my destop wherever I go. My eferences, my libraries. I am less tied to one computer anymore. All my information is online, accessible, centralized yet distributed. Whatever happens to my computer, I am in touch with my stuff, with the things that matter to me and my business. How free!
Well, I hadn't given up. Experience and patience paid off. I tried many things many times. As a mac user for instance I could synchronize my Yahoo calendar / notepad / address book with my MS Outlook, and my PDA. After weeks of synchronizations, after multiple overwrites, multiple duplications, deletions, multiple purchases of utilities which would supposedly simplify --- I gave up. Till now. Finally again, I have Yahoo Widgets. I carry my desktop with me wherever I go, wherever I have the Widgets installed. I just need to enter my login information and get the widgets updated w/ my latest information (my calendar, my notes, my address book, my to-do's). I can see and edit my information, in one only place.
Okay I was lucky. I have a Yahoo/SBC account that I have been using in years. So I am specific, still. But the point that I am trying to demonstrate is, we are all moving towards a seemless portable desktop. A fluid access to our information.
Another revelation was del.icio.us bookmarks, very recently. There's been tons of things written on it, really a lot of buzz. A blog convinced me to go over the so-simple (ugly?) user interface and try to finally use it. Once passed the first mitigated impression, you start building your bookmarks and keywords. By clicking around you discover others and their keywords and bookmarks. That's that social bookmarking! What a great and simple idea! Now, you are carrying your bookmarks around with you, you also have them categorized in a very special way that works for you. You are also discovering new places of value on the web! Right there a click away. We all use Google, but del.icio.us is different from raw - yes possibly elaborate - search. This is your own repository of information. You can crawl del.icio.us by key word and get to some very pertinent information, without any Googling.
You can also have del.icio.us work for you by setting some inbox key words and wait for it to suggest new findings based on these words...... Not finding over zillions of web cached pages, but over bookmarks that people considered of value. That's a human filter. By making your lists available to others, you also share your discoveries. Or advertise for yourself by inducing the Buzz. Read "The Several Habits of Wildly Successful del.icio.us Users" from Slacker Manager, for additional thoughts.
Another little habit that became tremendously important for me, has been to gather all my RSS feeds online, with Bloglines.... I tried alternatives before and after Bloglines, bought some newsreader for my mac: NetNewsWire, said to be the best of its kind on mac. Since I have multiple computers to use, again, I was in the maze of syncs that would not really work.
The combination of these three tools today brings my destop wherever I go. My eferences, my libraries. I am less tied to one computer anymore. All my information is online, accessible, centralized yet distributed. Whatever happens to my computer, I am in touch with my stuff, with the things that matter to me and my business. How free!
Subscribe to:
Posts (Atom)