How to install Anchor CMS on a Debian 7 VPS

anchor-cms

Anchor CMS is an open-source, lighter-weight and ultra-simple blogging system.It’s written in PHP and comes with markdown support, custom fields, themes, i18n compatibility and many more.

In this blog post we will write about how to install Anchor CMS on a Debian 7 (Wheezy) VPS with MySQL, PHP-FPM and Nginx.
.

Install MySQL and create a database.

apt-get update
apt-get upgrade
apt-get install mysql-server mysql-client
mysql -uroot -p
CREATE DATABASE login.
GRANT ALL PRIVILEGES ON anchor.* TO 'anchoruser'@'localhost' IDENTIFIED BY '_ANCHORUSER_PASSWORD_';
FLUSH PRIVILEGES;
/q

Install Nginx and PHP-FPM

apt-get install nginx php5-fpm php-cli php5-mysql php5-gd php5-mcrypt

Download the latest version of Anchor CMS as a zip file from: http://anchorcms.com

wget http://anchorcms.com/download -P /tmp
unzip /tmp/download -d /tmp

Create a root directory for your web site and move Anchor files into it

mkdir -p /var/www/yourwebsite.com/{public_html,logs}
rsync -aq /tmp/anchor-cms-*/ /var/www/yourwebsite.com/public_html/
chown -R www-data: /var/www/yourwebsite.com/public_html/

Nginx configuration.

Create a new Nginx server block with the following content

# /etc/nginx/sites-available/yourwebsite.com
server {
  server_name yourwebsite.com;
  listen 80;
  root /var/www/yourwebsite.com/public_html;
  access_log /var/www/yourwebsite.com/logs/access.log;
  error_log /var/www/yourwebsite.com/logs/error.log;
  index index.html index.php;
  location / {
    try_files $uri $uri/ @rewrites;
  }
  location @rewrites {
    #rewrite ^ /index.php last;
    rewrite ^/(.*)$ /index.php?url=$1 last;
  }
  location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
    access_log off;
    expires max;
  }
  location ~ /\.ht {
    deny  all;
  }
  location ~ \.php {
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

Symlink it and restart the server

ln -s /etc/nginx/sites-available/yourwebsite.com /etc/nginx/sites-enabled/yourwebsite.com
/etc/init.d/nginx restart

Anchor CMS installation

Open a browser pointing to your Anchor CMS installation, click on the “Run the installer” button and follow the on-screen instructions to complete the process.

Of course, you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24×7 and will take care of your request immediately. For more information, you can also check Install Anchor CMS on a Debian 8 VPS.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment