# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
# https://www.scalescale.com/tips/nginx/nginx-proxy-cache-explained-2/ | |
proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=my_diskcached:10m max_size=5g inactive=45m use_temp_path=off; | |
server { | |
listen 80; | |
set $cache_uri $uri; | |
server_name example.com; | |
location ~ /purge(/.*) { | |
proxy_cache_purge my_diskcached acme.mycachedefault$uri$is_args$args; |
"joomla1": { | |
"display": "Joomla Error Log", | |
"path": "/var/www/sites/REMOVED/log/error.php", | |
"refresh": 5, | |
"max": 10, | |
"notify": true, | |
"format": { | |
"type": "Joomla", | |
"regex": "|^((\\d{4})-(\\d{2})-(\\d{2})T(\\d{2})\\:(\\d{2})\\:(\\d{2})[+-](\\d{2})\\:(\\d{2}))\\t(.*?)\\s(.*?)\\t(.*?)\\t(.*?)[^\\r\\n]*$|U", | |
"export_title": "Error", |
# Creates SWAP on the server | |
# One of the things that I have lerned is that this kind of servers need swap. | |
# With these fast SSD disks you gain kind of "pseudo-ram"!!!. | |
sudo dd if=/dev/zero of=/swapfile bs=1G count=1 | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
sudo sysctl vm.swappiness=10 | |
sudo echo "vm.swappiness=10" >> /etc/sysctl.conf |
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below). | |
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G; | |
# Gzip was on in another conf file of mine...You may need to uncomment the next line. | |
#gzip on; | |
gzip_disable msie6; | |
gzip_static on; | |
gzip_comp_level 4; | |
gzip_proxied any; | |
# Again, be careful that you aren't overwriting some other setting from another config's http {} section. |
Install "Development Tools" and Vim editor:
sudo yum groupinstall -y 'Development Tools' && sudo yum install -y vim
Install Extra Packages for Enterprise Linux (EPEL):
sudo yum install -y epel-release
Download and install optional NGINX dependencies:
sudo yum install -y perl perl-devel perl-ExtUtils-Embed libxslt libxslt-devel libxml2 libxml2-devel gd gd-devel GeoIP GeoIP-devel
DELIMITER $$ | |
CREATE FUNCTION `fn_getparam`(param varchar(55), url varchar(2048)) RETURNS varchar(2048) CHARSET latin1 COLLATE latin1_general_cs | |
BEGIN | |
declare val varchar(2048); | |
declare _param varchar(60) DEFAULT CONCAT(param,'='); | |
select | |
case |
#!/usr/bin/env bash | |
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-08-25 | |
# | |
# _______________| httpstatus : get HTTP status code | |
# | |
# Usage: httpstatus URL [timeout] [--code or --status] [see 4.] | |
# ^message with code (default) | |
# ^code (numeric only) | |
# ^in secs (default: 3) | |
# ^URL without "http://" prefix works fine. |
<?php | |
/* | |
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED! | |
*/ | |
ini_set( 'display_errors', 1 ); | |
error_reporting( E_ALL ); | |
$from = 'webmaster@example.com'; |
IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).
USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.
IMPORTANT: The following setup assumes a 2 minute cache time. You can safely increase this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.
This configuration requires an HTTP Header and a user cookie (see the Joomla section) to identify if a user is logged in a site, in order to bypass caching overall. If your CMS provides a way to add these 2 requirements, then you can use this configuration to speed up your site or entire server. You can even exclude the domains you don't want to cache if you're looking to use