Install ssl certificate on apache server in ubuntu 16.04

Install Apache2

sudo apt-get install apache2

Enable SSL Module

sudo a2enmod ssl

Apply SSL Module to Site

sudo a2ensite default-ssl
sudo /etc/init.d/apache2 restart

Add your certificates in default-ssl.conf in /etc/apache2/sites-available

SSLEngine on
SSLCertificateFile /path/to/your_domain_name.crt
SSLCertificateKeyFile /path/to/your_private.key
SSLCertificateChainFile /path/to/DigiCertCA.crt


Sometimes you need to create a .ca-bundle file. Use this command to create it

Note : the names of files should be something similar

cat ComodoRSAAddTrustCA.crt ComodoRSADomain/Organization/ExtendedvalidationSecureServerCA.crt AddTrustExternalCARoot.crt >



Install nginx and php7 on ubuntu 16.04

First of all get all updates.

sudo apt-get update

Install nginx server

sudo apt-get install nginx

Now open http://server_domain_or_IP You should see the default page of nginx.

The default directory is /var/www/html/

Now lets install php for processing

sudo apt-get install php-fpm php-mysql

Uncomment the follwoing lines in /etc/nginx/sites-available/default

 location ~ \.php$ {

                include snippets/fastcgi-php.conf;


        #       # With php7.0-cgi alone:

        #       fastcgi_pass;

        #       # With php7.0-fpm:

                fastcgi_pass unix:/run/php/php7.0-fpm.sock;



index index.html index.htm index.nginx-debian.html;


index index.php index.html index.htm index.nginx-debian.html;

Restart nginx

service nginx restart

Now your nginx server is ready to execute php script.

Note : If you want to execute sql query through php script then use mysli_query() instead of mysql_auery().

Installing Apache,PHP,MySql,phpmyadmin on ubuntu server

Simply run these commands from terminal

Update the Package

sudo apt-get update


Install Apache2

sudo apt-get install apache2


Install PHP5

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5


Install MySQL

sudo apt-get install mysql-server 

lib apache2-mod-auth-mysql php5-mysql


Install PhpMyAdmin

sudo apt-get install phpmyadmin

You just installed phpmyadmin, but you also need to tell apache where to find phpmyadmin. phpmyadmin already comes with an apache configuration and we just need to use it. This configuration is available in: /etc/phpmyadmin/apache.conf

Add the following line to the end of /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf

Restart Apache2

sudo /etc/init.d/apache2 restart
or execute service apache2 restart

Now your web services is ready. You can upload your files into /var/www/ directory.


To install php5 library for mysql run this command

sudo apt-get install php5-mysql