<\/span><\/h2>\nTo install the latest Nginx version from the official Nginx repository, edit the ‘\/etc\/apt\/sources.list’ file:<\/p>\n
sudo vi \/etc\/apt\/sources.list<\/pre>\nAdd the following lines:<\/p>\n
deb http:\/\/nginx.org\/packages\/debian\/ jessie nginx\r\ndeb-src http:\/\/nginx.org\/packages\/debian\/ jessie nginx\r\n<\/pre>\n<\/span>3. Install MySQL Server<\/span><\/h2>\nsudo apt-get install mysql-server<\/pre>\nStop and remove Apache service:<\/p>\n
sudo service apache2 stop\r\nsudo apt-get remove apache2<\/pre>\n<\/span>4. Install Nginx<\/span><\/h2>\nInstall Nginx on your virtual server:<\/p>\n
wget http:\/\/nginx.org\/keys\/nginx_signing.key\r\nsudo apt-key add nginx_signing.key\r\nsudo apt-get update\r\nsudo apt-get install nginx<\/pre>\n<\/span>5. Configure Nginx<\/span><\/h2>\nConfigure Nginx to start on boot:<\/p>\n
sudo update-rc.d -f nginx defaults<\/pre>\n<\/span>6. Install PHP and PHP Modules<\/span><\/h2>\nInstall PHP and PHP modules required by SilverStripe CMS:<\/p>\n
sudo apt-get install php5 php5-cli php5-fpm php5-tidy php5-curl php5-mysql php5-gd php5-mcrypt php5-imap mcrypt<\/pre>\n<\/span>7. Download, Install and Configure SilverStripe CMS<\/span><\/h2>\nGet the latest version of SilverStripe CMS available at http:\/\/silverstripe.org\/download to a directory of your virtual server and extract it using the following commands:<\/p>\n
sudo apt-get install wget unzip\r\ncd \/opt\/\r\nwget https:\/\/silverstripe-ssorg-releases.s3.amazonaws.com\/sssites-ssorg-prod\/assets\/releases\/SilverStripe-cms-v3.4.0.zip\r\nmkdir -p \/var\/www\/html\/silverstripe\r\nunzip SilverStripe-cms-v3.4.0.zip -d \/var\/www\/html\/silverstripe<\/pre>\nCreate a new Nginx configuration file and add the following virtual block for your domain name:<\/p>\n
vi \/etc\/nginx\/conf.d\/your-domain.com.conf<\/pre>\nAdd the following lines:<\/p>\n
server {\r\n listen 80; \r\n\r\n server_name your-domain.com www.your-domain.com;\r\n root \/var\/www\/html\/silverstripe;\r\n\r\n if ($http_x_forwarded_host) {\r\n return 400;\r\n }\r\n\r\n location \/ {\r\n try_files $uri \/framework\/main.php?url=$uri&$query_string;\r\n }\r\n\r\n error_page 404 \/assets\/error-404.html;\r\n error_page 500 \/assets\/error-500.html;\r\n\r\n location ^~ \/assets\/ {\r\n sendfile on;\r\n try_files $uri =404;\r\n }\r\n\r\n location ~ \/framework\/.*(main|rpc|tiny_mce_gzip)\\.php$ {\r\n fastcgi_keep_conn on;\r\n fastcgi_index index.php;\r\n fastcgi_pass 127.0.0.1:9000; \r\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n include fastcgi_params;\r\n }\r\n\r\n location ~ \/(mysite|framework|cms)\/.*\\.(php|php3|php4|php5|phtml|inc)$ {\r\n deny all;\r\n }\r\n\r\n location ~ \/\\.. {\r\n deny all;\r\n }\r\n\r\n location ~ \\.ss$ {\r\n satisfy any;\r\n allow 127.0.0.1;\r\n deny all;\r\n }\r\n\r\n location ~ web\\.config$ {\r\n deny all;\r\n }\r\n\r\n location ~ \\.ya?ml$ {\r\n deny all;\r\n }\r\n\r\n location ^~ \/vendor\/ {\r\n deny all;\r\n }\r\n\r\n location ~* \/silverstripe-cache\/ {\r\n deny all;\r\n }\r\n\r\n location ~* composer\\.(json|lock)$ {\r\n deny all;\r\n }\r\n\r\n location ~* \/(cms|framework)\/silverstripe_version$ {\r\n deny all;\r\n }\r\n\r\n location ~ \\.php$ {\r\n fastcgi_keep_conn on;\r\n fastcgi_index index.php;\r\n fastcgi_pass 127.0.0.1:9000; \r\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n include fastcgi_params;\r\n fastcgi_buffer_size 32k;\r\n fastcgi_busy_buffers_size 64k;\r\n fastcgi_buffers 4 32k;\r\n }\r\n}<\/pre>\nDo not forget to replace your-domain.com with your actual domain name. Then, delete the ‘default’ Nginx configuration file:<\/p>\n
rm \/etc\/nginx\/conf.d\/default.conf<\/pre>\nOpen the ‘\/etc\/php5\/fpm\/pool.d\/www.conf’ file and change the ‘listen’ variable.<\/p>\n
Change:<\/p>\n
listen = \/var\/run\/php5-fpm.sock<\/pre>\nto<\/p>\n
listen = 127.0.0.1:9000;<\/pre>\nEdit the \u2018\/etc\/php5\/fpm\/php.ini\u2019 configuration file:<\/p>\n
vi \/etc\/php5\/fpm\/php.ini<\/pre>\nAdd\/modify the following settings:<\/p>\n
safe_mode = Off\r\nmagic_quotes_gpc = Off\r\nmemory_limit = 128M\r\ndate.timezone = \"America\/Chicago\"\r\n<\/pre>\nThe web server user (www-data) needs to be able to write to files and directories inside the ‘\/var\/www\/html\/silverstripe’ directory, so it can easily be accomplished by executing the following command:<\/p>\n
sudo chown www-data:www-data -R \/var\/www\/html\/silverstripe\/<\/pre>\n