In this tutorial, we will explain how to install Symphony CMS on an Ubuntu 14.04 VPS with MariaDB, PHP-FPM and Nginx. Symphony CMS is a XSLT-powered open source content management system which enables users to create and manage websites and web applications. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 14.04 VPS.
Login to your VPS via SSH
ssh user@vps
Update the system and install necessary packages
[user]$ sudo apt-get update && sudo apt-get -y upgrade [user]$ sudo apt-get install software-properties-common git
Install MariaDB 10.0
[user]$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db [user]$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main' [user]$ sudo apt-get install mariadb-server
When the installation is complete, run the following command to secure your installation:
[user]$ mysql_secure_installation
Next, we need to create a database for our Symphony installation.
[user]$ mysql -uroot -p MariaDB [(none)]> CREATE DATABASE symphony; MariaDB [(none)]> GRANT ALL PRIVILEGES ON symphony.* TO 'symphonyuser'@'localhost' IDENTIFIED BY 'symphonyuser_passwd'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q
Install PHP-FPM and Nginx
Installing PHP and Nginx is pretty easy, just run the following command:
[user]$ sudo apt-get install nginx php5-fpm php5-cli php5-xsl php5-xmlrpc php5-gd php5-mysqlnd
Clone the Symphony CMS git repository
Create a root directory for your web site and clone the git repository from github using the following commands:
[user]$ mkdir -p ~/yourSymphonySite.com/{public_html,logs} [user]$ git clone git://github.com/symphonycms/symphony-2.git ~/yourSymphonySite.com/public_html
If you want to add the optional extensions run:
[user]$ cd ~/yourSymphonySite.com/public_html [user]$ git checkout --track origin/bundle [user]$ git submodule update --init --recursive
PHP-FPM configuration
Create a new PHP-FPM pool for your user:
[user]$ cat << EOF | sudo tee /etc/php5/fpm/pool.d/$(whoami).conf [$(whoami)] user = $(whoami) group = $(whoami) listen = /var/run/php5-fpm-$(whoami).sock listen.owner = $(whoami) listen.group = $(whoami) listen.mode = 0666 pm = ondemand pm.max_children = 5 pm.process_idle_timeout = 10s; pm.max_requests = 200 chdir = / EOF
Restart PHP-FPM:
[user]$ sudo service php5-fpm restart
Nginx configuration
Create a new Nginx server block with the following content:
[user]$ cat << EOF | sudo tee /etc/nginx/sites-available/yourSymphonySite.com server { server_name yourSymphonySite.com; listen 80; root $HOME/yourSymphonySite.com/public_html; access_log $HOME/yourSymphonySite.com/logs/access.log; error_log $HOME/yourSymphonySite.com/logs/error.log; index index.php; location / { rewrite ^(.*[^/])\$ \$1/ permanent; if (!-d $request_filename) { rewrite ^/(.*)\$ /index.php?symphony-page=\$1 last; } } location ~ ^/symphony(/?.*)\$ { if (!-f \$request_filename) { rewrite ^/symphony/?\$ /index.php?mode=administration&\$query_string last; rewrite ^/symphony(/(.*/?))?\$ /index.php?symphony-page=\$1&mode=administration&\$query_string last; } } location ~ ^/image/(.*)\$ { try_files \$uri \$uri/ /extensions/jit_image_manipulation/lib/image.php?param=\$1; } location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)\$ { access_log off; expires 30d; add_header Pragma public; add_header Cache-Control "public, mustrevalidate, proxy-revalidate"; } location ~ \.php\$ { fastcgi_split_path_info ^(.+\.php)(/.+)\$; fastcgi_pass unix:/var/run/php5-fpm-$(whoami).sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; } location ~ /\.ht { deny all; } location ~ /\.git { deny all; } location ~ ^/manifest/(.*)\$ { return 403; } location ~ ^/workspace/utilities/(.*).xsl\$ { return 403; } location ~ ^/workspace/pages/(.*).xsl\$ { return 403; } location ~ ^/(.*).sql\$ { return 403; } location ~ (^|/)\. { return 403; } } EOF
Activate the server block by creating a symbolic link :
[user]$ sudo ln -s /etc/nginx/sites-available/yourSymphonySite.com /etc/nginx/sites-enabled/yourSymphonySite.com
Test the Nginx configuration and restart nginx:
[user]$ sudo nginx -t [user]$ sudo service nginx restart
Final steps
Open http://yourSymphonySite.com/install in your favorite web browser and you should see the Symphony install screen. Provide the database and user information and click on the “Install Symphony” button.
After the installation is complete, do not forget to remove the installer files:
[user]$ rm -rf ~/yourSymphonySite.com/public_html/install/ ~/yourSymphonySite.com/public_html/workspace/install.sql
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 setup this for you. They are available 24×7 and will take care of your request immediately.
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.