Brian Wigginton Lab and Nerdery

LAMP Stack Optimizations for Small Servers

Posted on January 21, 2011

This WordPress blog is running on a 256MB Slicehost VPS. Here are the settings I have in place to keep Apache and MySQL responsive. Without these settings, the server would often come to a grinding hault and SSH interactions would become very slow and sometimes hang.

Apache - httpd.conf - mpm_prefork_module Settings

<IfModule mpm_prefork_module>
    StartServers          2
    MinSpareServers       2
    MaxSpareServers       4
    MaxClients            50
    MaxRequestsPerChild   500
</IfModule>

I found that I saved a bunch of memory just by using less apache processes. Instead of spawing 8 processes by default I'm only going to spawn one and limit the max spares to 4, which means after some load I should only have 4 processes lingering around waiting to serve pages.

MySQL - my.cnf settings

skip-innodb
skip-bdb
skip-ndbcluster

I dropped mysql's memory useage by about 11M (sitting right under 5M right now) just by disabling innodb support. I've also done some very heavy WordPress caching using wp-supercache. this basically caches every page and post so that I'm just serving up static html content instead of processing the entire WordPress stack for every page load.

Filed under: Apache, MySQL No Comments

Subversion: Repository on Subdomain

Posted on October 24, 2009

This is a tutorial on how to setup a Subversion repository on a subdomain with Apache. This assumes you have Subversion and Apache already installed on your system.

Subversion Setup

First you need to create a repository somewhere in your file system. Then grant apache permissions on that directory.

svnadmin create /var/svn/repository
sudo chown -R www-data:www-data /var/svn/repository

Controlling Access

Access to the repo via the web will be controlled by an htpasswd file located at /var/svn/svn-auth-file. Use the htpasswd command to create the file.

htpasswd -c /var/svn/svn-auth-file <username>

Execute the script again without the -c argument to add more people to the list.

htpasswd /var/svn/svn-auth-file <username_two>

Apache Setup

I usually setup Apache to use Names VirtualHosts to handle multiple websites. We'll make a new named virtualhost for subversion repository.

<VirtualHost *:80>
ServerName svn.your_domain.com
<location />
DAV svn
SVNPath /var/svn/repository

AuthType Basic
AuthName "Subversion repository"
AuthUserFile /var/svn/svn-auth-file
Require valid-user
</location>
</VirtualHost>

   
Google+