Post4VPS Forum | Free VPS Provider
Install nginx, php, mariadb - Ubuntu 14.04 - Printable Version

+- Post4VPS Forum | Free VPS Provider (https://post4vps.com)
+-- Forum: VPS Discussion (https://post4vps.com/Forum-VPS-Discussion)
+--- Forum: Tutorials (https://post4vps.com/Forum-Tutorials)
+--- Thread: Install nginx, php, mariadb - Ubuntu 14.04 (/Thread-Install-nginx-php-mariadb-Ubuntu-14-04)



Install nginx, php, mariadb - Ubuntu 14.04 - Neco - 12-02-2016

This is a guide how to install stack of software which will allow us to serve dynamic pages.
It includes:
  • NGINX - Web server and proxy
  • PHP FPM -  server side language processor
  • MariaDB - Database server (RDBMS)
1. Update the source lists and the software

Code:
sudo apt-get update
sudo apt-get upgrade


2. Install nginx

This will install the Webserver and proxy server nginx which is very light and uses fewer resources than apache.

Code:
sudo apt-get install nginx

3. Install PHP Processor

PHP is a server-side scripting language designed primarily for web development but also used as a general-purpose programming language.

Code:
sudo apt-get install php5-fpm php5-mysql


4. Install MariaDB
MariaDB is a community-developed fork of MySQL. They have better performance and frequent updates. 


Code:
sudo apt-get install mariadb-server mariadb-client


5. Edit nginx configuration

Open the default configuration file

Code:
sudo nano /etc/nginx/sites-available/default

Delete everything and paste the following

Code:
server {
   listen 80 default_server;
   listen [::]:80 default_server ipv6only=on;

   root /usr/share/nginx/html;
   index index.php index.html index.htm;

   server_name server_domain_name_or_IP;

   location / {
       try_files $uri $uri/ =404;
   }

   error_page 404 /404.html;
   error_page 500 502 503 504 /50x.html;
   location = /50x.html {
       root /usr/share/nginx/html;
   }

   location ~ \.php$ {
       try_files $uri =404;
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_pass unix:/var/run/php5-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
   }
}

Replace server_domain_name_or_IP with your domain name or IP and the root with root path of your website.

That would be it. Now you are ready to create your dynamic website.