Switching... » Apache http://switch.richard5.net How to build your Mac into a internet server using open source software Mon, 25 May 2009 14:13:02 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 New location Apache and PHP in new instruction set http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/ http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/#comments Wed, 31 Jan 2007 20:32:27 +0000 Richard5 http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/ Just wanted to see if there are any objections to move the Apache and PHP installations from their current location in ‘/Library/’ to ‘/usr/local/’

The layout for Apache will become:

<layout DIYMacServer>
    prefix:        /usr/local/apache2
    exec_prefix:   ${prefix}
    bindir:        ${exec_prefix}/bin
    sbindir:       ${exec_prefix}/bin
    libdir:        ${exec_prefix}/lib
    libexecdir:    ${exec_prefix}/modules
    mandir:        ${prefix}/man
    sysconfdir:    /etc/httpd/
    datadir:       /var/www
    installbuilddir: ${datadir}/build
    errordir:      ${datadir}/error
    iconsdir:      ${datadir}/icons
    htdocsdir:     ${datadir}/htdocs
    manualdir:     ${datadir}/manual
    cgidir:        ${datadir}/cgi-bin
    includedir:    ${prefix}/include
    localstatedir: /var
    runtimedir:    ${localstatedir}/run
    logfiledir:    ${localstatedir}/log/httpd
    proxycachedir: ${localstatedir}/cache/httpd
</Layout>

This brings everything in-line with normal other installs. The configuration is as it was with the original Apache in ‘/etc/httpd‘ and the log, cache and pid file are all in ‘/var‘. Although I’m still having doubts about the datadir, I would have put it in ‘/var/www/‘ but on the normal OS X install it would be in ‘/Library/WebServer/‘. What do you think ?

PHP5 will be located in ‘/usr/local/php5‘, the php.ini file will be located in ‘/etc‘.

I hope to open up the new site tomorrow if all goes well…

]]>
http://switch.richard5.net/2007/01/31/new-location-apache-and-php-in-new-instruction-set/feed/ 5
Apache upgrade to 2.2.4, adapted documentation http://switch.richard5.net/2007/01/14/apache-upgrade-to-224-adapted-documentation/ http://switch.richard5.net/2007/01/14/apache-upgrade-to-224-adapted-documentation/#comments Sun, 14 Jan 2007 08:43:31 +0000 Richard5 http://switch.richard5.net/2007/01/14/apache-upgrade-to-224-adapted-documentation/ Well it has been a few days since I got the email for the new release of Apache and I was going to write about it sooner. But as happens often I got sidetracked and didn’t think of it until error reports came in via email and comments that there was something wrong with my compilation instructions.

It looks like we need an extra flag to compile properly namely the “--with-included-apr” option to force internal APR functionality and not from another package. The installation page has been updated accordingly !

There are more changes and bugs fixed besides this change, you can read all about them at the download page of apache, read the Changes file. I can’t link to it directly as it is dynamically altered to link to a mirror in your neighborhood.

]]>
http://switch.richard5.net/2007/01/14/apache-upgrade-to-224-adapted-documentation/feed/ 0
Updated to v2 on my own server http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/ http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/#comments Wed, 13 Sep 2006 13:02:27 +0000 Richard5 http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/ I used yesterday to recompile Postfix, Courier-Auth, Apache and PHP with the 5.0.24a MySQL libraries. I just used my own instructions to compile everything.

I first did Postfix and Courier-auth as they would cause the least problems when it would go wrong. My backup mailserver would still receuve all mail and forward it to me when the mailserver is back online. It all went without a hitch, just did a restart of the programs and all was running as expected.

Apache posed an issue, how to compile and install, followed by compiling PHP without disturbing all the people looking at my sites. In the end it was simple. Compile and install Apache2, don’t restart Apache so the old version keeps running but the new software is available on disk. Then compile and install PHP using the new Apache installation files and when that is done restart Apache and all would be fine. Well that’s what I thought…

There was a small error in the modules that I included in the httpd.conf. Some of them, all concerning authentication, where rewritten and given different names. I was still trying to load the old ones as I didn’t update my httpd.conf to reflect these changes. So Apache2 wouldn’t start. I just commented out the old modules and added the new ones in my httpd.conf and presto, Apache 2.2.3 and PHP 5.1.6 are now running on my server, together with Postfix 2.2.3.

They’ve been running for almost a day now and I haven’t gotten any complaints yet.

If you are still running “ISP in a box” version 1 and want to upgrade but are still a bit afraid on how to do this let me know and I’ll help out.

Update:
Just found out there was an error, got a call on the phone from some of my friends that they couldn’t email anymore. When checking the logfiles I foud out I forgot a step after compiling and installing Courier auth:

sudo chmod o+x /usr/local/var/spool/authdaemon

In the logfile there was the error:

SASL authentication failure: cannot connect to Courier
      authdaemond: Permission denied

Which means I didn’t follow my own instructions !

]]>
http://switch.richard5.net/2006/09/13/updated-to-v2-on-my-own-server/feed/ 4
Rotating your Apache logfiles http://switch.richard5.net/2006/08/21/rotating-your-apache-logfiles/ http://switch.richard5.net/2006/08/21/rotating-your-apache-logfiles/#comments Mon, 21 Aug 2006 18:43:10 +0000 Richard5 http://switch.richard5.net/2006/08/21/rotating-your-apache-logfiles/ Wow, did I forget to do something. I was just cleaning up my mac mini server. Well that’s what you do when you’ve been playing around with lots of configurations and compiled different versions of software to see if it will work. When I found out that I completely forgot about the logfiles for my Apache installation. Some of the logfiles of the more popular sites where already a whopping 100+ Mb.

Normally, for the Apple installed Apache, the logfiles would reside in /var/log/httpd, but I didn’t think and just followed the standard layout that was provided by the installation which directed the logfiles into /Library/Apache2/logs as you can see in the installation document. This means that the default weekly script (located in /etc/periodic/weekly) that takes care of the regular maintenance of your Mac, and rotates your Apache logfiles, didn’t take care of my new Apache2 logfiles.

So I’ve created a new script that rotates my Apache2 logfiles without having to change everything. You can download my apache.local script and copy it into your /etc/periodic/weekly/ directory, give it proper flags/rights to make it executable using:

sudo chown root:wheel /etc/periodic/weekly/apache.local
sudo chmod +x /etc/periodic/weekly/apache.local

Then test it out by running:

sudo /etc/periodic/weekly/apache.local

Now your logfiles won’t fill up your harddrive unnecessarily and by keeping smaller logfiles your Apache will run a bit better as well. Please note that your logfiles should have a filename that ends with log or it won’t work.

Note: please vote where the logfiles should reside (before I start updating the installation documents), in /var/log or /Library/Apache2/logs in the related forum topic. You need to register and wait for account activation if you haven’t already. Sorry, it’s needed to prevent those pesky spammers.

]]>
http://switch.richard5.net/2006/08/21/rotating-your-apache-logfiles/feed/ 0
Finished installation instructions on MySQL, Apache and PHP http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/ http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/#comments Sun, 13 Aug 2006 20:13:53 +0000 Richard5 http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/ This as taken me much, much longer than I ever planned it to take. First there was the introduction of the Intel based Mac’s that I needed to comprehend. Secondly the many problems I’d encountered with the shared library support in the MySQL as many of you have read in previous posts. Third there was the happy occasion of the birth of my daughter which prevented me from spending much time behind the screen.

But it’s done, I’ve finally finished the instruction for installing (and compiling) MySQL 5, Apache 2 and PHP 5. Hope you are able to use them well.

I’m currently working on the instructions for the mailserver as there are some tweaks needed to get that working with the current setup. There where some issues with Intel based Macs and SSL support but I’ve got that solved. Hope to get that finished in a very short time… (not naming dates here, getting careful… ;-) )

]]>
http://switch.richard5.net/2006/08/13/finished-installation-instructions-on-mysql-apache-and-php/feed/ 1
Documented securing (HTTPS) virtual hosts in Apache http://switch.richard5.net/2006/08/06/documented-securing-https-virtual-hosts-in-apache/ http://switch.richard5.net/2006/08/06/documented-securing-https-virtual-hosts-in-apache/#comments Sun, 06 Aug 2006 20:41:49 +0000 Richard5 http://switch.richard5.net/2006/08/06/documented-securing-https-virtual-hosts-in-apache/ Just a quick post, after I just found out how to do this in a very simple way, about some new documentation I created on how-to simply secure multiple virtual domains on your webserver. It’s not perfect (there will be warnings in the browser), but it will work. Continue and read the page to see how simple it can be.

It’s the most simple way to do this without spending any money on official certificates or multiple ip-addresses. Especially that last point was the most difficult to solve. It seems, but I don’t know for sure as I’m not an expert on the subject, that it isn’t possible to configure more than one certificate per ip-address. Forgot the correct explanation and won’t go into wild guessing…

It works for me and I hope it will for you as well.

Note: People will get a warning that your certificate isn’t signed by a certified authority and if you use different domain names the browser will complain that the certificate and the domain don’t match. But if the user will accept the warning and continues the access to the website will be secured by SSL. This is very usefull if you don’t want your password to be send in the clear.

]]>
http://switch.richard5.net/2006/08/06/documented-securing-https-virtual-hosts-in-apache/feed/ 1
Documented adding virtual hosts in Apache http://switch.richard5.net/2006/05/11/documented-adding-virtual-hosts-in-apache/ http://switch.richard5.net/2006/05/11/documented-adding-virtual-hosts-in-apache/#comments Thu, 11 May 2006 21:00:26 +0000 Richard5 http://switch.richard5.net/2006/05/11/documented-adding-virtual-hosts-in-apache/ Just a short post, I had a lot of questions from people on how they should go forward setting up websites on their newly installed Apache2 webserver. I had documented how to do this for the postfix mailserver from the beginning of this project. So here is the long overdue documentation that makes it all clear on how to setup name-based virtual hosts on Mac OS X. This by the way works for all versions of Apache.

]]>
http://switch.richard5.net/2006/05/11/documented-adding-virtual-hosts-in-apache/feed/ 0
First preview of ISP in a box 2.0 http://switch.richard5.net/2006/04/03/first-preview-of-isp-in-a-box-20/ http://switch.richard5.net/2006/04/03/first-preview-of-isp-in-a-box-20/#comments Mon, 03 Apr 2006 20:31:03 +0000 Richard5 http://switch.richard5.net/2006/04/03/first-preview-of-isp-in-a-box-20/ I’m rewriting, as discussed earlier, the ISP in a box documentation. Most effort is currently being put into removing the dependancies from the Server Logistics installation packages. They are very slow in updating their releases and I didn’t like to depend on them in case there is another security issue. The other item I wanted to address was the remarks I got on improving the installation process itself. People suggested if I could provide the configuration files and compilation scripts to prevent some errors and make the whole process a lot easier.

So here is the first public preview of the first pages of the new documentation. it’s not yet ready to be used properly as I only got MySQL and Apache2 covered. PHP is coming before the end of the week. But I wanted to see how you like the new way of documenting. Hope you like it…

Two more remarks:

  • I’ve created a page to keep you informed on the funding of the new Intel based Mac mini. Donations and AdSense income are going strong and I think I can order an Intel based Mac mini before the end of the summer. I you want to contribute to this effort as well, use the PayPal button on the right side of the page.
  • I don’t like the phrase “ISP in a box” too much but I still can’t think of another one that covers what I’m documenting here. So I wanted to ask you, can you think of a better phrase or slogan ? Or do you think “ISP in a box” is good enough ? Please let me know what you think.
]]>
http://switch.richard5.net/2006/04/03/first-preview-of-isp-in-a-box-20/feed/ 1
Upgraded Apache to version 2.0.55 http://switch.richard5.net/2006/02/28/upgraded-apache-to-version-2055/ http://switch.richard5.net/2006/02/28/upgraded-apache-to-version-2055/#comments Tue, 28 Feb 2006 09:57:49 +0000 Richard5 http://switch.richard5.net/?p=75 I was stuck with a problem I encountered a few weeks ago when I got back from my holiday. I was trying to post my holiday snapshots on my webserver to show to my friends, when I noticed that the big pictures didn’t want to load completely in the browser. They only downloaded for about 1/3 in the browser and I had to refresh the page several times to get the full photo. I’ve been banging my head on this for some time until David W. pointed me to a bug in Apache 2.0.54 that caused the error. He also explained how I could upgrade to 2.0.55 and keep all the things I had configured with the package from Server Logistics in place. If you have the Apache package running from them you might as well follow these instructions as well.

First download Apache HTTP server version 2.0.55. Unpack it into a directory and open the file config.layout for editing and add the following code at the end of the file.


<layout ServLog>
prefix: /Library/Apache2
exec_prefix: ${prefix}
bindir: ${exec_prefix}/bin
sbindir: ${exec_prefix}/bin
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/modules
mandir: ${prefix}/man
sysconfdir: ${prefix}/conf
datadir: ${prefix}
installbuilddir: ${datadir}/build
errordir: ${datadir}/error
iconsdir: ${datadir}/icons
htdocsdir: ${datadir}/htdocs
manualdir: ${datadir}/manual
cgidir: ${datadir}/cgi-bin
includedir: ${prefix}/include
localstatedir: ${prefix}
runtimedir: ${localstatedir}/logs
logfiledir: ${localstatedir}/logs
proxycachedir: ${localstatedir}/proxy
</Layout>

This configures the build and configuration process to mimic the configuration used by ServerLogistics and keeps everything in place as it is. If you’ve done that then open a Terminal session, change to the directory in which you unpacked the source code and edited the config.layout file and run the following command:

./configure --enable-layout=ServLog --enable-mods-shared=all --with-ssl=/usr --with-mpm=prefork --enable-ssl --enable-dav --enable-cache --enable-proxy --enable-shared --disable-static --disable-unique-id --disable-ipv6 --enable-logio --enable-deflate --with-ldap --with-ldap-include=/usr/include --with-ldap-lib=/usr/lib --enable-ldap --enable-auth-ldap --enable-cgi --enable-cgid --enable-suexec

This will create and configure the Makefile for actually building the Apache webserver like the package from Server Logistics. When it’s done just execute the next command:

make

When that’s finished and you are sure (made a backup of your system and all) you can issue:

sudo make install

Stop and start Apache and you are running the new 2.0.55 version. Don’t do a restart as that just reloads the configuration. Use the Apache preference pane you installed earlier to stop and start it or use the apachectl command in the Terminal as a root user.

]]>
http://switch.richard5.net/2006/02/28/upgraded-apache-to-version-2055/feed/ 8
Migrated to the mini, finally… http://switch.richard5.net/2006/01/03/migrated-to-the-mini-finally/ http://switch.richard5.net/2006/01/03/migrated-to-the-mini-finally/#comments Tue, 03 Jan 2006 14:55:07 +0000 Richard5 http://switch.richard5.net/?p=60 I’ve started the new year with migrating everything from my old Sun Ultra 5′s who have been running my internet services for the past few years to the Mac mini. The pages you are looking at now are served from a Mac mini as it was my intention for some time. The mini is setup using my own documentation with no deviation whatsoever.

It was quite easy doing the migration, just copying the HTML/PHP files, making a backup of all the databases and restoring them on the mini for the web part. For the mail server I used postfix admin to create all the mailboxes and aliases for all the domains. Then made backups from the original server and restored them on the new mini.

I did some tests on the web part, to see if everything was configured as it should and tested the mail server to see if it didn’t become another spam relay server and it blocked unwanted spammers from sending mail via my server. I asked a friend to try abuse my server and used the relay service at www.abuse.net to check independently. It all worked out. The server is secure, still could use some tweaking but I will report on that later.

]]>
http://switch.richard5.net/2006/01/03/migrated-to-the-mini-finally/feed/ 1