# Setting up a very simple LAMP test server

## ElleStone

Hello All,

I would like to set up a very simple Gentoo lamp test server. I already have Gentoo itself up and running (64-bit no-multilibs). I've set up test servers under Ubuntu, Debian, and openSUSE, but never under Gentoo.

I'll probably have other questions, but my first question is about modules. Possibly relevant information:

*By "test server" I mean Apache should only listen to localhost and only on port 80. For example, on an Ubuntu test server that I recently set up, this is the "netstat -anp" line for Apache:

```
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN      1048/apache2
```

*The test server's main purpose is for working on articles prior to posting them to my live website (the live website is hosted commercially).

*I don't use ssl. 

*I don't use cgi or SSI.

*I don't use ftp-related stuff. 

*I don't use vhosts (there is just one website).

*I don't need spelling mistakes corrected (speling module should not be included?).

*I do use PHP to serve up the "in common" portions of my website.

*I'm experimenting with Wordpress, so I do need the rewrite module.

*I've already installed mariadb rather than mysql.

Any advice regarding modifying/pruning down the Apache modules list is greatly appreciated. Looking at the output from "emerge --info", there are 50 different APACHE2_MODULES. http://en.gentoo-wiki.com/wiki/Apache2/APACHE2_MODULES (actually the google cache thereof) gives one-line explanations for the Apache modules, but alas to this newbie, at first glance the explanations might as well have been written in Klingon. And at second glance, hardly any of them seem appropriate for a very simple test server. 

Elle

----------

## ElleStone

Based on further investigation, apache2_modules to use for a basic test lamp server:

http://httpd.apache.org/docs/2.2/mod/index.html

http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

Probably use these modules (these apache USE flags are all enabled by default, along with a bunch of other USE flags that I disabled in package.use):

alias 

authz_host 

dir 

info (?)

log_config 

mime 

negotiation (?)

rewrite

All the other default apache USE flags probably can be disabled.

To get the php-apache module, add "apache2" to the php USE flags and install php.

Apparently one shouldn't use threads with php:

http://serverfault.com/questions/231628/apache-mpms-worker-vs-prefork

So the appropriate additional apache USE flags hopefully are:

"mpms_prefork" USE flag: use

"threads" USE flag: don't use

"mpms_worker" USE flag: don't use

I installed apache and php configured as above, and going to localhost with Firefox reveals "It works!"

Now for some questions:

1. Here is what I put in make.conf:

```
APACHE2_MODULES="authn_core authz_core socache_shmcb unixd alias auth_host dir info log_config mime negotiation rewrite"
```

These default "emerge --info" entries - authn_core authz_core socache_shmcb unixd - don't correspond to any of the apache USE flags. What do they do? Should they be in listed in APACHE2_MODULES in make.conf? Do the USE flags need to be set twice, one in package.use and once again in make.conf?

2. How does one list which modules Gentoo's Apache2 is actually using? "apachectl -t -D DUMP_MODULES" doesn't work.

3. Why are there 5 VHOST subprocesses listed in htop? I did compile apache without the vhost USE flag.

4. Just to avoid any potential issues, although Apache2 and php both compiled with link time optimization, I recompiled both without lto. Has anyone used apache/php compiled with lto? (I compiled both with graphite and openmp enabled in the cflags and ldflags).

Finding on-line documentation for setting up a test server is easy, but of course none of them talk about modules in any depth and none of them are specific to Gentoo (leastways I didn't find any). I've read through several Gentoo pages on Apache, and I'm working my way through the Slicehost Gentoo Apache pages (http://articles.slicehost.com/2009/8/14/gentoo-installing-apache). Input, suggestions, advice on what I've done so far to set up my Gentoo test LAMP server would be very welcome. 

Elle

----------

