Linux notes

research | programming | linux


Apache install on Gentoo

Emerge steps

  • use flags : add at least apache2 and php in your make.conf
  • install
        emerge -av apache
        emerge -av php
    

Configuration

  • Edit the file named /etc/apache2/httpd.conf and add a ServerName. The value localhost will do if you just want to do some test on your machine.
        ServerName localhost
    
  • include PHP module in your Apache configuration, by editing /etc/conf.d/apache2
        APACHE2_OPTS="-D PHP5 ..."
    
  • Start the service on your machine
        /etc/init.d/apache2 start
    

Note that apache will fail silently in case you haven't set an alias between localhost and the name of your machine. To see this, check if httpd is running. If not, see the log file in /var/log/:

  gesundheit apache2 # cat /var/log/apache2/error_log 
  [Sun Jun 07 14:04:24 2009] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "gesundheit"
  Configuration Failed

This can be fixed (ref) setting the alias in /etc/hosts

  gesundheit apache2 # cat /etc/hosts 
  ...
  # IPv4 and IPv6 localhost aliases
  127.0.0.1     localhost       gesundheit
  ::1           localhost       gesundheit
  ...
  • Now you can check everything's working fine by visiting http://localhost in your browser.
  • as a quick start you can already make some HTML pages available on your web server, by adding a Directory section to your /etc/apache2/httpd.conf file:
    <Directory /var/www/localhost/htdocs>
    Options Indexes Includes FollowSymLinks
    order allow,deny
    allow from all
    </Directory>
    

Tomcat

Tomcat can be installed by running

  emerge -av tomcat
  /etc/init.d/tomcat-6 start

Visit http://localhost:8080 to check your configuration.

References

Author: <philippe.veber [AT] gmail.com>

Date: 2009-03-15 dim.

HTML generated by org-mode 6.21b in emacs 23