How To Install Linux, Nginx, MySQL, PHP

Standard

Step 1: Install the Nginx Web Server

sudo apt-get update
sudo apt-get install nginx

Type one of the addresses that you receive in your web browser. It should take you to Nginx’s default landing page:

http://server_domain_or_IP

If you see the above page, you have successfully installed Nginx.

Step 2:Install MySQL to Manage Site Data

sudo apt-get install mysql-server

You will be asked to supply a root (administrative) password for use within the MySQL system.

The MySQL database software is now installed, but its configuration is not exactly complete yet.
To secure the installation, we can run a simple security script that will ask whether we want to modify some insecure defaults. Begin the script by typing:

mysql_secure_installation

Answer y for yes, or anything else to continue without enabling.

Step 3: Install PHP for Processing

sudo apt-get install php-fpm php-mysql

Step 4: Configure Nginx to Use the PHP Processor

We do this on the server block level. Open the default Nginx server block configuration file by typing:

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

Currently, with the comments removed, the Nginx default server block file looks like this:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.html index.htm index.nginx-debian.html;

    server_name _;

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

We need to make some changes to this file for our site.

  • First, we need to add index.php as the first value of our index directive so that files named index.php are served, if available, when a directory is requested.
  • We can modify the server_name directive to point to our server’s domain name or public IP address.
  • For the actual PHP processing, we just need to uncomment a segment of the file that handles PHP requests by removing the pound symbols (#) from in front of each line. This will be the location ~\.php$ location block, the included fastcgi-php.conf snippet, and the socket associated with php-fpm.
  • We will also uncomment the location block dealing with .htaccess files using the same method. Nginx doesn’t process these files. If any of these files happen to find their way into the document root, they should not be served to visitors.
    The changes that you need to make are in red in the text below:
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name server_domain_or_IP;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.1-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

When you’ve made the above changes, you can save and close the file.

Test your configuration file for syntax errors by typing:

sudo nginx -t

If any errors are reported, go back and recheck your file before continuing.

When you are ready, reload Nginx to make the necessary changes:

sudo systemctl reload nginx or sudo service nginx restart

Step 5: Create a PHP File to Test Configuration

We can do this by creating a test PHP file in our document root. Open a new file called info.php within your document root in your text editor:

sudo nano /var/www/html/info.php

Type or paste the following lines into the new file. This is valid PHP code that will return information about our server:

<?php
phpinfo();

When you are finished, save and close the file.

http://server_domain_or_IP/info.php

If php does not work restart by using command sudo service php7.1-fpm restart

thank you..

Advertisements

What’s Next?

Standard

After a long time,I don’t know want to write.

Let me tell you guys that one thing shits a lot in this 3 months is a project named s*** ** *** ** this project is very boring started hating the guy who gave this project.

And the next good thing ubuntu version is upgrade 17.10 that thing looks cool with unity Gnome but I like shell theme I made my sys looks like MAC. I add some plugins to make it look like Mac.Let me explain you how to do that.

1.First thing is to install Gnome-tweak-tool

sudo apt-get install gnome-tweak-tool

2.Next have to install gnome-shell

sudo apt-get install gnome-shell

3.should switch over to gnome shell

4.Download the mac theme over the link MAC theme

5.open the Gnome tweak tool 

At first have to select extension and turn on the user theme. Then on the Global Dark Theme.
then select the Shell theme, And change the windows GTK and Icons and select Mac theme in shell themes.

6.Install Dash to dock extension using the link Dash to Dock

That’s all about it you can see get the mac look in your ubuntu machine.

At last exam’s started it goes like three exam three days continuously.

After 4 Days of Workshop…..

Standard

Hi there,
After the 4 days of workshop in Big data Analytics using R is final over. Atlast had some idea about Data Analytics. And I can’t be a Data Scientist ever because that’s full of mathematics. And thats not fair to know the future. “Future is future” so wait for it.

My First Blog

Standard

Hi there,
This is first blog and the truth is I don’t know to write have read one or two.I’m sorry forgot to introduce myself. Arunprakasan AKV well thats my name.I’m the guy who intend to see what’s up next, And This World Teach Me Daily I’m the one who follows it.Diligent in Web Development as well as Mobile App.It’s Cool when I Work in a Team or Individual. Then i would Like to Hangout With My Buddies, Thats it. And my favorite lines is “Everything is Right When You Believe That is Right.”