something.com

This command should then be followed by the sudo make, then sudo make test and finally sudo make install. Now I realise at this point you might be thinking “what the hell…”. Well, yes, there are a few command prompts install lines, but really, that’s about it. The benefit of these will then accrue later down the track when it comes to having a configurable server layer.

At this stage you should be able to run a few test commands to ensure that everything is working out fine:

    sudo /usr/local/apache2/bin/apachectl start
    You should then shut the server down in the interim with:
    sudo /usr/local/apache2/bin/apachectl stop

Now, if all works out well, the above two commands should operate with-out added problems and give us a smooth server launch, in the background, for a brief period of time. If you want to check whether some pages are served then simply point your browser over to http://localhost. This should display a default web page which you can now broadcast to the world. Now, if this hasn’t happened, it might be due to your httpd.conf and .conf files that are controlling your process.

These files are essentially configuration files that ensure set the server variables. To make life easy, under Mac OS X, you can take advantage of the pre-existing configuration files set out in your installation. These will need to be modified a little bit. My recommendation would be to open a finder window, to point it to the /private/etc/apache2/ directory and then copy all files and directories. Then repoint your finder window over to your new Apache installation over at /usr/local/apache2/conf/ directory and simply paste all the contents.

This should populate your new installation’s configuration directories with a number of files and directories. Of value to us are the httpd.conf file and the /users/ directories. The first file is of primary importance, and part of the configuration will involve commenting out some of the old native Mac OS X installations DSO linked packages. These should no longer be required as we have built the core packages at the binary level. So in order to do this we need to:

    Open up the httpd.conf file:
    sudo pico /usr/local/apache2/conf/httpd.conf
    And then go through the file until we reach lines that ressemble the following:
    LoadModule authn_file_module libexec/apache2/mod_authn_file.so
    Simply comment these lines out by putting a # symbol in front of them. FYI for PICO, most of the navigation commands are listed at the bottom of the screen and are accessed by pressing the CTRL key and the relevant command letter.

Now this should cover the core operating needs, however, we might as well also check that a few other settings are properly set and also clear out any conflicts that might arise with the new Apache installation from the default apache build. So to clear this out we will work on the pid lock files, and other log files that the Apache daemon create during runtime. These files are set out by default by Apache but, as we copied over the old httpd.conf file, they are going to point out to exactly the same location as the native build. Therefore, it might be worthwhile changing these manually:

    Open up the httpd.conf file once more:
    sudo pico /usr/local/apache2/conf/httpd.conf
    now navigate over to the section with ServerRoot at the opening line and replace the past entry with the following directives:
    ServerRoot “/usr/local/apache2/”
    LockFile “/var/log/apache2-2-16/apache.lock”
    PidFile “/var/log/apache2-2-16/apache.pid”
    CustomLog /var/log/apache2-2-16/access_log “%h %l %u %t \”%r\” %>s %b”
    ErrorLog /var/log/apache2-2-16/error_log
    LogLevel warn
    RewriteLog /var/log/apache2-2-16/rewrite_log
    RewriteLogLevel 2
    Next this is to remember to check any old Log path entries that might be in the file and ensure that these are commented out. Simply press CTRL+W to search for the Log string throughout the file and, where present, simply comment out by using a #
    Once done, exit the PICO window but remember to save.

Okay, so we’re almost there, however, we still need to ensure that the server runs up from the right directory. There is an almost infinite amount of possibilities offered by Apache in mirroring your local filesystem over on to the web so it is important not to go for overkill on this one. In my case, I wanted to access the core directory of my server from my user’s home directory, therefore, only really this directory was critical to me and was going to be the main root location for the website. In order to do this, we need to go once more into the httpd.conf directory and modify a number of settings:

    Open up your httpd.conf file once more
    sudo pico /usr/local/apache2/conf/httpd.conf
    Now go through the directory until you reach a <Directory> section.
    There should be two of these in your file, we will leave the first one as is (recommended to maintain a default restrictive value on the directory) but the second one should begin with a statement similar to <Directory “a local directory path” >. It is this section that we will focus on ‘freeing up’ a little from the restrictions of old. My recommendation would therefore be to replace the contents of this sub-section with the following code:
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    Furthermore, you should now change the local directory path section to your preferred personal directory path. For a Mac OS X user this will be typically a /users/username/Sites/ directory location.
    Remember to save the relevant path and then to exit

Continue to Part 3

Comments are closed.

Disclaimer: Material posted on 24-something does not contain (and should not be construed as containing) personal financial or investment advice or other recommendations. The information provided does not take into account your particular investment objectives, financial situation or investment needs. You should assess whether the information provided is appropriate to your particular investment objectives, financial situation and investment needs. You should do this before making an investment decision based on the material above. You can either make this assessment yourself or seek the assistance of an independent financial advisor. 24-Something, associated parties and Tariq Scherer accept no responsibility for any use that may be made of these comments and for any consequences that result.