redirecting domain.com to www.domain.com.

So you have a web server and one/some domain names. You want to have all requests to domain.com to go to www.domain.com. most companies have this redirect in place (Apple is an example). I was stumped when I first set out to do this…so here is what I learned from our friends on the Apache mailing list.

ServerName www.domain.com
ServerAlias domain.com
Redirect permanent / http://www.domain.com/

ServerName www.domain.com
ServerAdmin [email protected]
DocumentRoot /Volumes/www/domain.com/documents


This set up in Apache will then redirect all domain.com requests to www.domain.com.
You cannot beat mailing lists’ support!
[tags]apache, vhosts, redirect[/tags]

Tiger Server 10.4 Makes Me Growl

Well it is WWDC time and Apple has released information about my friend and your’s Mac OS X Server, the new improved version. We finally get mobile home directories, I am really excited about that, but then Apple talks about “Certificate management”….gee I wonder if you can rename the cert files (when you serve more than one site) and have apache start? That might be too much to ask, but I am glad Apple thinks it is something to mention. I also wonder how they are going to address the change ip issue. Time will tell, but I will not hold my breath. I would love to go somewhere, most likely a school district, set up Mac OS X Server to serve exactly like Apple thinks it should serve and have everything just work. I know it can, but if you try anything different…you will find problems. (see past posts) Mac OS X Server scares me for serveral reasons, but none more than the idea of UNIX admins looking at Apple’s awesome hardware and then being completely disappointed with the OS when trying to customize it. (you know, like adding more than one ErrorDocuments for a custom error reporting script…who would ever want that?) I can deal with Mac OS X Server issues…but I do not want to see other’s put off by Apple’s weird configurations. How can users talk to developers…and have the developers actually respond to the user’s issues? I have had engineers duplicate problems and release after release the issues still remain. Thoughts? We now have the hardware that is attracting high end users, let’s give them the software too!

Mac OS X Server, Apple, A Truce Please?

Well…one look at the “Safari cannot connect to localhost because your computer is connected to the internet” message I received yesterday while trying to view my web site while on the train and I about lost it. After I hacked the apache conf, that was enough for me to put up the white flag when dealing with Mac OS X Server. Apple needs to hire me or some other apache/mac based person to tweak the apache conf in Mac OS X Server. I am so frustrated at this point I am going to throw Mac OS X client on my Xserve so I can get away from Apple’s “weird trying to be helpful GUI”. I have written to the engineers, had them duplicate the problem, and then not fix it.
I do want to use Mac OS X Server, but not in the state it is now. So close Apple…so close, just hire me and I will help you obtain “Industrial Strength” status with web serving. 😉

Little Tech Reminders

I often perform the same tasks over and over and yet forget some little thing. This post is a reminder for me.

General Apple hints.

Mac OS X Server hints, aka Industrial Strength hints.

  • Don’t change Mac OS X Server’s IP 😉
  • When installing SSL certs on OS X Server (at least in 10.3 and below), if you change the cert file location from anything but the default, you will also need to change it in all your sites or Mac OS X Server will not be able to restart apache.
  • Apple: “Well Known” TCP and UDP Ports Used By Apple Software Products
  • Server Monitor not working after a clone? Make sure it is by adding: hwmond:respawn:/usr/sbin/hwmond # Hardware Monitor daemon to /etc/watchdog.conf

Tutorials and general resources.

Web development hints.

Changing the IP On Mac OS X Server, Lessons Learned

Is it common to change a server’s IP? I suppose yes and no. Yes, say you decide to move to a data center or your office moves or you want to configure a server to replace another server already using the IP you want for DNS reasons or you just need to reorganize your subnet. Yes, a change in IP is possible. Apple, thanks for figuring that out. I have been using Mac OS X Server since it first appeared on the scene and the sight of a “wheel” user really jarred me. Until now (Mac OS X Server 10.3.x) changing the IP was difficult at best. I called myself a “professional Mac OS X Server installer” for awhile because of needing to change the IP.

Every new version of Mac OS X Server promised ways of changing the IP with ease. Somewhere along the line, I think with Mac OS X Server 10.2 Apple even included an option in the install to use a temporary IP. Hmm, last week when I configured my Xserve (many times) the option was no longer available. Darn…it worked so well! (not) I had hopes for the new “changeip” (man changeip on OS X Server for more information) command, but like all other attempts to change the IP on my Mac OS X Server it failed, and failed miserably.

I do not really understand what the problem is. I have several Mac OS X clients that run web servers and other server processes and when I change that IP, the OS does not think anything of it. Mac OS X Server however is “industrial strength” and therefore has many more complicated issues. In theory you are can log in as root, type in a command like: “changeip 10.0.0.1 10.0.0.2 oldhost newhost” to change the IP from 10.0.0.1 to 10.0.0.2. I was so sure Apple would not burn me that I spent a day configuring my Xserve and then finished the configuration over Remote Desktop at home so I could come in, log in in single user mode and run the changip command.

I walked in my office, happily rebooted the server in single user mode, typed the command in, and received a NetInfo error. No worries, the error code was no where to be found in Apple’s Knowledge Base(No the link is not incorrect, that is just my way of giving you first hand experience of what I got) NetInfo…another friend of mine. Ok, I thought, maybe something weird happened, I will just restart. Nope, same thing. Ok, so I booted up normally and logged in as root. Bingo! The command did it’s thing…or did it? I could now ping the server on the new IP. I was completely amazed, but with all my history with Mac OS X Server, I had to see it in the GUI to believe it.

I opened System Preferences>Network Settings. The old IP was still in the GUI. Ok…maybe it just needed a restart. Restarted, still the old IP remained. I changed it in the GUI, and the even gave it a restart. Why would I care about the GUI when I could ping? Mac OS X Server and I go way back. Guess what? None of my sites work. Guess what? All the configs come back fine, no errors. Guess what? You still cannot change the IP on Mac OS X Server without some pain. Thank goodness for Carbon Copy Cloner. I ended up just cloning the old server drive and putting that on the new Xserve. So close Apple, so close!

Mail.app Plugins

When Mac OS X beta appeared on the scene with a mail application I was very excited. I was a die hard Eudora fan but I am always happy to try an Apple application…you know, since I have an Apple tattoo and all. I was very disappointed with what Apple had released so I went back to Eudora. Eudora had a lot features that Mail.app did not which I used to help me get my job done. I used email templates religiously for users that forgot their web password, needed instructions on this and that so I stuck with Eudora in Mac OS 9.x. When Eudora carbonized their mail application, all bets were off because it was ugly and nasty, even if it had more functionality, I have issues with ugly interfaces, so I sucked it up and went on to use Apple’s Mail.app. I still do not have my templates, but I keep drafts of template emails that I copy and paste. Moral of the story, there are some great Mail.app plugins that everyone using Mail.app should check out. Apple has made great strides to improve Mail.app, but you can also customize it even further with plugins.

Favorite Tech Web Sites

Each day I load up the same tech web sites in my browser’s tabs and I thought I would share them with everyone:
http://www.versiontracker.com
http://www.macdevcenter.com
http://www.macnn.com
http://www.macosxhints.com
http://the.taoofmac.com/space
http://www.macintouch.com
http://www.php-mag.net
http://www.phparch.com
http://www.php.resourceindex.com
http://www.afp548.com