Web Server Setup

Hardware:

  • FST Servers VM-2 plan
  • 512MB RAM
  • 20GB hard disk

Software:

  • Nginx
  • MySQL
  • PHP5
  • WordPress

Nginx Setup

Symbolic link:

mkdir /var/www
ln -s /usr/share/nginx/www/ /var/www

Create wp-multi.conf for my WordPress Multi Site setup:

log_not_found off;

rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Created php.conf for basic PHP setup for a site:

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

PHP-FPM Optimization

Changed the following in /etc/php5/fpm/pool.d/www.conf

pm.start_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 50

MySQL Optimization

Changed the following in /etc/mysql/my.cnf

[mysqld]
key_buffer = 8M
max_allowed_packed = 8M
table_cache = 24
thread_concurrency = 5

[isamchk]
key_buffer_size = 8M
sort_buffer_size = 8M

 

Nginx Conf for Javascript Routing

server {
listen 80;
server_name appreviews.joesteinkamp.com;
root /usr/share/nginx/www/appreviews;
index index.html index.htm index.php;
try_files $uri /index.html;
}

Write a Comment