Compiling Apache 64 bit on Solaris 10 with Sun Studio
Solaris 10 ships with Apache 2.0.x as a 32 bit binary by default. LiveTime prefers to use 64 bit applications for true scalability and memory partitioning as well as processor specific optimizations for AMD and Intel.
First download the latest source for apache. We prefer the 2.2 version due to the performance increases and easier configuration. We also use Sun Studio 12 for compilation due to the number of chip level optimizations available for AMD and Intel processors.
If you have a prepackaged version of Apache from Sun already it is important to remove this first using the package tool, since we are going to install our optimized edition into the same location. You can remove the existing version with:
shell> pkgrm SUNWapch2d SUNWapch2r SUNWapch2u
After downloading and decompressing the Apache source you can build with the following commands (Updated for Sun Studio 12 Update 1).
shell> CC="/opt/sunstudio12.1/bin/cc" CFLAGS="-xtarget=generic -m64 -xO4 -I/usr/sfw/include/openssl" CXX="CC" CXXFLAGS="-xtarget=generic -m64 -xO4 -I/usr/sfw/include/openssl" LDFLAGS="-L/usr/sfw/lib/amd64 -R/usr/sfw/lib/amd64" ./configure --prefix=/usr/apache2 --datadir=/var/apache2 --localstatedir=/var/apache2 --sysconfdir=/etc/apache2 --enable-mods-shared="most ssl" --with-ssl=/usr/sfw --with-included-apr shell> gmake shell> gmake install
Note that by default Apache will be compiled on Solaris 10 using the prefork MPM (Multi-Processing Module), which scales very well. We have also chosen to compile using openssl using shared modules.
Once installed you need to optimize the httpd.conf settings in /etc/apache2 directory and make sure the following information is included:
User webservd Group webservd ServerName 127.0.0.1:80 MaxKeepAliveRequests 256 ServerLimit 1024 MaxClients 512 AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.html index.php TraceEnable off
You can test the installation by executing /usr/apache2/bin/apachectl -k start. This should return no errors and you will be able to hit the URL of the machine this is installed on. We have also include settings for PHP which will be discussed in a subsequent post.