How to setup a web server – beginner guide

If you are planning to host a website over a cloud machine or any other platform, you’ll need to install some services or libraries used in your web application. Here i list out very basic services that can be used in any web application:
  1. PHP
  2. memcache
  3. ffmpeg
  4. apache
  5. mysql
  6. phpmyadmin
  7. git
  8. node
  9. composer

I am assuming that you are aware of what are there services so i am not explaining these services. Here are the steps to install these services:

Install PHP

you can install php 7.0 by executing following command:

sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0-cli php7.0-common php7.0-mbstring php7.0-gd php7.0-intl php7.0-xml php7.0-mysql php7.0-mcrypt php7.0-zip

 

Install MySQL

sudo apt-get install mysql-server

Install phpmyadmin

phymyadmin is a simple and popular GUI to manage your database. you can install this by following command:

sudo apt-get install phpmyadmin php-mbstring php-gettext

Install memcached

Memcached is a distributed memory caching system. It speeds up websites having large dynamic databasing by storing database object in Dynamic Memory to reduce the pressure on a server whenever an external data source requests a read.

sudo apt install memcached
sudo apt install php-memcached
sudo service apache2 restart
cross check: telnet localhost 11211
Flush cache: flush_all

Install git

sudo apt-get install git-core
Check installed git version: git --version

Install node

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
Check version: node -v

Install composer

sudo apt-get install curl
sudo mv composer.phar /usr/local/bin/composer
cross check: run command “composer” to check

Install ffmpeg

FFmpeg is a popular and widely used open source project which includes libraries and programs for handling audio, video and other multimedia files and streams. or if we talk about simple use cases like video compression, merge or split audio and video, get thumbnail from video etc, then it can be achieve by executing just a single ffmpeg command. Here are steps to install ffmpeg:
sudo add-apt-repository ppa:jonathonf/ffmpeg-3
sudo apt-get update
sudo apt upgrade
sudo apt install ffmpeg
Additional configuration:
1. enable apache rewrite for .htaccess redirections
sudo a2enmode rewrite
2. Check whether required php extensions like curl, mbstring etc are installed or not. All installed extensions will be listed under /etc/php/7.1/mods-available/ directory.
ll /etc/php/7.1/mods-available/
3. Execute following command to check loaded apache modules
apache2ctl -M
check whether ssl_module is there in list. If not than ssl module is not loaded. You can load ssl module by following command:
sudo a2enmod ssl
Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top