Apache

From EpixStudios

Jump to: navigation, search

http://gentoo-wiki.com/HOWTO_Apache2

Contents

Installing

Get package from portage, compile and install.

emerge -av apache

Create default directory structure

emerge --config apache

Start it using it's init script

/etc/init.d/apache2 start

Test this works by pointing your web browser at http://localhost/


nano /etc/apache2/httpd.conf
ServerAdmin hostmaster@domain.tld


Virtual hosts

http://gentoo-wiki.com/HOWTO_Linux_Virtual_Hosting_Server#Virtual_Web_Hosting http://httpd.apache.org/docs-2.0/vhosts/

Apache's virtual hosting mechanism allows you to create sub-domains to your site. This is useful for hosting many websites on one server or splitting up your own site (e.g. www.yoursite, wiki.yoursite, mail.yoursite).

make sure that '-D DEFAULT_VHOST' is set in the 'APACHE2_OPTS' to enamble virtual hosting and '-D PHP5' for PHP execution.

nano /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D SSL_DEFAULT_VHOST -D PHP5 -D SSL"
nano /etc/apache2/vhosts.d/vhosts.conf
NameVirtualHost *:80
#NameVirtualHost *:443

<VirtualHost *:80>
   DocumentRoot /var/www/localhost/htdocs/
   ServerName epixstudios.co.uk
   ServerAlias www.epixstudios.co.uk
   ErrorLog /var/log/apache2/epixstudios-error
   CustomLog /var/log/apache2/epixstudios-access combined
</VirtualHost>

###################################################
# Courchevel
###################################################
<VirtualHost *:80>
   DocumentRoot /var/www/courchevel/htdocs
   ServerName courchevel-1650.com
   ServerAlias www.courchevel-1650.com
   ServerAlias courchevel.epixstudios.co.uk
   ErrorLog /var/log/apache2/courchevel-error
   CustomLog /var/log/apache2/courchevel-access combined
   <Directory />
       Options            FollowSymLinks
       AllowOverride      All
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>


Restart apache and check that the changes were succesfull

/etc/init.d/apache2 restart

PHP Optimising

APC (Alternative PHP Cache) is a PHP extension which caches php opcode instead of forcing php to reinterpret every script every time it is executed. This saves a lot of processing power and delivers your PHP pages much quicker. It will probably be integrated within PHP6 but until then, you can use Gentoo's emerge to install it quickly and simply. Default settings should be fine for most people.

emerge -av dev-php5/pecl-apc


PHP Documentor

You must have 'tokenizer' extension installed or you may get errors like this:

using default (slower) Parser - get PHP 4.3.0+
and load the tokenizer extension for faster parsing (your version is 5.2.2-pl1-gentoo
WARNING: sourcecode command-line option is ignored for PHP versions < 4.3.0
ERROR: nothing parsed

In gentoo edit '/etc/portage/package.use' and add 'tokenizer' to the line starting 'dev-lang/php'. Create a new line if it doesn't exist already.

dev-lang/php tokenizer
Personal tools