Server apache dengan httpd-2.2.2.tar.gz (suse)
Posted by intrik on May 3, 2007
Download Source Get the source from http://httpd.apache.org/download.cgi . At the time of writing this tutorial the best available version was 2.2.2 ( httpd-2.2.2.tar.gz ). This tutorial is known to work with all 2.x.x Apache versions.
Unpack, Configure, Compile Go to the directory with the downloaded file and enter:
# tar -xzf httpd-2.2.2.tar.gz # cd httpd-2.2.2 # ./configure –prefix=/usr/local/apache2 –enable-so The configure options deserve a little bit more of detail here. The most important –prefix option specifies the location where Apache is to be installed. Another commonly used option –enable-so turns on the DSO support, i.e. available modules compiled as shared objects can be loaded or unloaded at runtime. Very handy.
To compile some modules statically (they are always loaded, faster execution times), use –enable-module option. To compile a module as a shared object, use –enable-module=shared option.
SSL SupportTo support secure connections, you need to specify –enable-ssl option when you run ./configure. In addition to that, you will also have to configure your httpd.conf file later.
Note: Make sure that openssl is installed on your system before you run ./configure with –enable-ssl. If not, download the latest version from http://www.openssl.org/source/ , unpack, configure, make, make install. You will also need to generate server certificates.
Configuration ExampleFor example, to compile the mod_rewrite module statically and mod_auth_digest as a DSO, and to enable secure connections, enter:
# ./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite –enable-auth-digest=shared –enable-ssl For all available configuration options and their default values check the Apache documentation or type ./configure –help.
Tip: If you are upgrading from older Apache version, you may want to copy config.nice from the old Apache installation directory (if available) to where you unpacked the new Apache tarball file. Run ./config.nice instead of ./configure. This way all the previous configure options will be applied to the new installation effortlessly.
Once you configured everything as you like, compile and install the software:
# make # make install Edit httpd.confBefore you start Apache server, edit the httpd.conf file according to your needs (the file is generously commented).
# vi /usr/local/apache2/conf/httpd.conf I suggest the following changes (some of them may have already been set automatically) on the appropriate places inside httpd.conf (ignore “…”):
ServerRoot “/usr/local/apache2” … User apache2 Group www … DocumentRoot “/foo/path_to_your_www_documents_root” … Options FollowSymLinks AllowOverride None … DirectoryIndex index.php index.html index.htm index.html.var
“apache2” and “www” are the user and user group I have previously created (see Prerequisites)
Apart from these, later you will probably want to specify detailed options for specific directories, load some DSO modules, setup virtual servers etc.
SSL Support If you wish to enable SSL for secure connections (assuming that you have configured Apache with –enable-ssl option – see above), add the following in the appropriate sections inside httpd.conf (ignore “…”; replace “laffers.net” with your own):
Listen 80Listen 443… ServerName laffers.net:443 SSLEngine on ErrorLog /usr/local/apache2/logs/error_log_laffers.net TransferLog /usr/local/apache2/logs/access_log_laffers.net SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SetEnvIf User-Agent “.*MSIE.*” \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 After you installed PHP (next part of this tutorial), few additional changes need to be done to httpd.conf (but they are usually made automatically during PHP installation).
Setup Access PrivilegesDon’t forget to setup Apache access privileges to your www directories:
# chown -R apache2 /foo/path_to_your_www_documents_root # chgrp -R www /foo/path_to_your_www_documents_root # chmod -R 750 /foo/path_to_your_www_documents_root “apache2” and “www” are the user and user group I have previously created (see Prerequisites)
Start and Stop Apache ServerAfter everything is set up, start Apache:
# /usr/local/apache2/bin/apachectl start
Similarly, if you wish to stop Apache, type:
# /usr/local/apache2/bin/apachectl stop
Automatic Startup It’s a good idea to let your Apache server start automatically after each system reboot. To setup Apache automatic startup, do:
# cp /usr/local/apache2/bin/apachectl /etc/init.d # chmod 755 /etc/init.d/apachectl # chkconfig –add apachectl # chkconfig –level 35 apachectl on