Operating System » Linux » Linux Ubuntu Server

Setup Linux Ubuntu Server

Ubuntu 12.04 Linux 3.4 Kernel 64-bit with Ngnix 1.2, PHP 5.3, MySQL 5.5, PostgreSQL 9.1 + Postgis 1.5, Mapserver 6.

Installation Date: 1 August 2012

apt-get install zip make

apt-get install mysql-server mysql-client
/etc/init.d/mysql restart

apt-get install nginx
sudo /etc/init.d/nginx restart

apt-get install php5 php5-cgi php5-fpm
apt-get install php5-cli
apt-get install php-pear
apt-get install php5-mysql
apt-get install php5-curl
apt-get install php5-gd
apt-get install php5-mcrypt

change nginx configuration file /etc/nginx/sites-available/default

server {
listen 80;
root /var/www;
index index.php index.html;
server_name localhost;
location ~ \.php$ {
try_files $uri =403;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
}

sudo /etc/init.d/php5-fpm restart

create a php file /var/www/info.php

http://127.0.0.1/info.php

If get 502 bad gateway error, try the following:

netstat -an | grep 9000 # is the port open?

pico /etc/php5/fpm/pool.d/www.conf
change the following line from:
listen = /var/run/php5-fpm.sock
to:
listen = 127.0.0.1:9000

sudo /etc/init.d/php5-fpm restart

# port 9000 should be open
netstat -an | grep 9000

Install Accelerator

apt-get install build-essential
apt-get install libpcre3-dev
apt-get install php5-dev
apt-get install php-apc
pecl install memcache
pecl install apc

You should add "extension=memcache.so" to /etc/php5/fpm/php.ini
Use phpinfo() page to check both memcache and APC are loaded

The APC ini settings are as follows:

apc.enabled=1
apc.shm_segments=1
apc.optimization=0
apc.shm_size=32
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1
apc.cache_by_default=1
apc.stat=0

Updated On: 15.02.17