Ubuntu 16.04 Server Par Nginx, MySQL, PHP (LEMP) Install Kaise Kare

How To Install Linux, Nginx, MySQL, PHP (LEMP stack) in Ubuntu 16.04 in Hindi. Ji haa, Is tutorial me main aapko Ubuntu Server Linux, Nginx, MySQL, PHP (LEMP Stack) Install Karne Ke Bare Me Hindi Me Btaunga. Is tutorial ko follow kar ke aap next 10 minute me apne server par LEMP stack install kar sakte ho.

Install LEMP Ubuntu DigitalOcean

LEMP Software stack software ka ek group hai jise dynamic web pages aur web applications ke liye use kiya jata hai. ye ek short word hai jo Linux operating system, Nginx web server, MySQL database or dynamic processing PHP se milkar bana hai. Aap LEMP server par wordpress install kar blog run kar sakte ho.

Is tutorial ko follow karne se pahle aapko sudo privileges apne server par ek regular non-root user account hona chahiye. iske liye aap digitalocean ke tutorial Ubuntu 16.04 initial server setup check kare. User account banane ke nad uske username ke sath is tutorial ke steps ko follow kare.

Ubuntu 18.04 Server Par Nginx, MySQL, PHP (LEMP) Install Kaise Kare

Wese Default username root hota hai. Agar aap non-root user account nahi banana chahate to root username sue kare. But non-root account create karna security ke lyie better hai.

How to Install Linux, Nginx, MySQL, PHP (LEMP) on Ubuntu 16.04

Ye ek hindi tutorial hai or meri koshish hogi ki main step by step clearly explain kar saku fir bhi agar aapko koi point samajh na aaye to aap comment section me apni problem bta sakte hai.

LEMP installation process shuru karne se pahle aapko 3 kaam karne honge.

1. Buy Cloud Server

Sabse pahle to aap digitalocean se cloud hosting buy kar le. Iske liye aapko pay karne ki jarurat nahi hai aap humare article niche btaye ko follow kar digitalocean se 2 month ki free hosting buy kar sakte hai.

2. Start Server Machine

Hosting buy karne ke bad aapko cloud server create karna hoga. Iski jankari yaha hai.

3. Logging on Server with PUTTY

Cloud server build karne ke bad apne server par PUTTY ke sath log in kar console open karna hai iski jankari ke liye ye post check kare.

Jab aap PUTTY ke sath server se connect ho jaye to niche ke btaye step follow kare.

Install LEMP On Ubuntu 16.04 – Complete Guide in Hindi

Ye tutorial Linux, Nginx, MySQL, PHP (LEMP Stack) install karne ke bare me nahi LAMP yani Linux, Apache, MySQL, PHP ke bare me nahi.

Step 1: Install Nginx Web Server

Is process ke liye use kiye jane wale all software direct Ubuntu ke default package se aayenge. Iska matlab hai ki hum installation ko complete karne ke liye package management apt ka istemal kar sakte hai.

Actually, hum first time apt use kar rahe hai so hume server local package index ko update karna chahiye. Hum is tarah se server update karenge uske bad nginx install karenge.

$sudo apt-get update
$sudo apt-get install nginx

Ab Ubuntu 16.04 par nginx ko installation par run karne ke liye configure kiya jayega. Jab nginx installation process complete ho jaye to aap apne server IP address ya domain ko is type se browser me open kare.

http://server_domain_or_IP

Ab aap nginx default landing page par pahuch jaoge jiska look kuch is type ka hoga.

Nginx default landing page

Agar aap is tarah ka page dekhe hai to iska matlab hai aap successfully Nginx install kar liya hai.

Step 2: Install MySQL to Manage Site Data

Ab jab humare pas ek web server hai to hume apni site data ko store and manage karne ke liye MySQL database management system install karne ki jarurat hogi.

Aap ise type karke easily MySQL install kar sakte hai.

$sudo apt-get install mysql-server

MySQL system ke bhitar upyog ke liye aapko root (administrative) password provide karne ke liye kaha jayega. Aap databae ke liye apne hisab se koi bhi password type kare.

Aapke password type karne ke bad aapko password re-enter karne ke liye kaha jayega. Password re-enter kar OK par click kare ya enter key button press kare.

Ab kuch hi time me MySQL complete install ho jayega. Aap chahe to installation ko secure kar sakte hai uske liye ye command use kare.

$mysql_secure_installation

Ab aapko password ke liye pucha jayega, yaha aapko MySQL root account password use karna hai jo aapne mysql install karte time set kiya tha. Ab aap apne hisab se password secure kar sakte ho.

Warning: Is feature ko tabhi use kare jab aap strong password ke bare me achhe se jante ho kyuki isse aapko password set karne me problem ho sakti hai.

Step 3: Install PHP for Processing

Ab humne Nginx server install karne ke sath humare data ko store and manage karne ke liye MySQL database ko bhi install kar liya hai. Lekin abhi bhi hum dynamic content generate nahi kar sakte uske liye hume PHP ki jarurat hogi. (WordPress ke liye PHP ki hi jarurat hogi.)

Iske alawa Nginx server me native PHP processing shamil nahi hai isiliye hume PHP ke sath ye bhi install karni hogi. Iske liye hum php-fpm use kar sakte hai jo “FastCGI process manager” ke liye hai.

PHP ke all type ki files ko install karne ke liye ye code line use kare.

$sudo apt-get install php-fpm php-mysql

PHP install hone ke bad hume PHP processor ko configure karna hai.

Configure PHP Processor

Humne PHP ko successfully install kar liya hai lekin hume apne setup ko or jyada secure karne ke liye thodi slight configuration karni hogi.

Iske liye php-fpm main configuration file ko open kare.

$sudo nano /etc/php/7.0/fpm/php.ini

Ab is file me hume cgi.fix_pathinfo parameter search karna hai. Console me search, copy, paste, delete and move karne ke lyie alag alag shortcut hote hai jo bottom me diye gaye hai. Jaise search karne ke liye Ctrl+W, Paste karne ke liye mouse right click or delete karne ke liye Ctrl+K button use hota hai.

Is line ke first me semi-colon (;) and last me “1” hoga.

Hume semi-colon ko remove karna hai or last me se “1” ki jagah “0” set karna hai.

/etc/php/7.0/fpm/php.ini
cgi.fix_pathinfo=0

Jab aapki editing complete ho jaye to file save karne ke liye Ctrl+X key button press kar YES select kar enter key press kare.

Ab hume PHP processor ko restart karna hoga uske liye ye command use kare.

$sudo systemctl restart php7.0-fpm

Ye humare dwara kiye gaye changes ko implement karega.

Step 4: Configure Nginx to Use the PHP Processor

Ab humare pas all required components installed hai. Ab bas hume Nginx ko humare dynamic content ke bare me btana hai.

Hum ise server block level par kar sakte hai. Iske liye aap niche di command se default Nginx server block configuration file ko open kare.

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

Ab aapke samne jo file open hogi usme nginx default server block ka look kuch is tarah ka hoga.

/etc/nginx/sites-available/default
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;
    }
}

Hume humari site ke liye is file me kuch badlav karne ki jarurat hai.

  • Sabse pahle hume humare index directive ke pahle index.php value add karne ki jarurat hai taki index.php name ki file ko served kiya ja sake.
  • Hum server_name directive me apne server ke domain name or public IP address ko point kar sakte hai.
  • Actual PHP processing ke liye hume sirf us file ka ek segment nikalna jaruri hai jo har ek line ke samne pund symbols (#) ko nikalkar PHP request ko handle karta hai. Ye location ~\.php$ location block, fastcgi-php.conf snippet, and the socket associated with php-fpm se juda hoga.
  • Hum isi method se server block se .htaccess file ko remove kar denge kyuki Nginx .htaccess support nahi karta.

File optimize karne ke bad uska look kuch is type ka hoga. Humne jin lines me changes kiya hai main unko red color me disalay kar raha hu.

/etc/nginx/sites-available/default
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.0-fpm.sock;
    }

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

Agar aap upar btaye anuar sahi changes kar liya hai to aap file ko save kar close kar sakte hai.

Ab humne koi galti to nahi ki hai wo check karne ke liye ye command use kare.

Agar koi bhi error show hota hai to wapis above step ko follow kar file ko open kar sahi se configure kare or ek bar fir error check kare.

$sudo nginx -t

Jab sabkuch Ok ho to hume is changes ko apply karne ke liye Nginx server ko restart karna hoga uske liye ye command line use kare.

$sudo systemctl reload nginx

Step 5: Create a PHP File to Test Configuration

Ab aapne LEMP stock completely set up kar liya hai. Ye confirm karne ke liye hum ek PHP page create kar apne server par load karke test kaenge.

Hum documents root me ek PHP file bana kar aesa kar sakte hai. Iske liye aap info.php file ko open kare.

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

New file me nimn lines ko type ya paste kare. Ye valid PHP code hai jo humare server ke bare me information deta hai.

/var/www/html/info.php
<?php
phpinfo();

Jab aap editing complete kar le to file ko save kar close kar de.

Ab aap apne internet browser par ja kar apne domain name or ip address ke sath is page ko is tarike se open kar sakte hai. /info.php:

http://server_domain_or_IP/info.php

Ab aapko ek web page dikhna chahiye jo apake server ke bare me btata ho or PHP ke dwara generate kiya gaya ho.

php info page

Agar apa aesa page dikhayi deta hai to Congratulations! aapne Nginx ke sath PHP processing successfully install kar liya hai.

Actually, ye file humne sirf ye test karne ke liye banayi thi ki humara server proper work kar raha hai ya nahi. Isme aapke server ki details hoti hai jisse koi aapke server ko access karne ki koshish kar saktahai so security reason se ise delete kar dena hi behtar hai.

Is file ko delete karne ke liye ye command use kare.

$sudo rm /var/www/html/info.php

Ab aapne Ubuntu 16.04 par Nginx, PHP, MySQL yani LEMP stock ko completely install kar liya hai. Ab bas aapko is par software istall karne ki jarruat hai. Example, ab aap is par WordPress install karne ke liye ready ho.

Lemp server par wordpress install karne ki jankari ke liye humari ye post read kare.

Ye bhi padhe,

I hope ye tutorial aapke liye useful and helpful sabit hoga. Agar haa to ise social media par other people ke sath share jarur kare.

Avatar for Jumedeen Khan

About Jumedeen Khan

मैं इस ब्लॉग का संस्थापक और एक पेशेवर ब्लॉगर हूं। यहाँ पर मैं नियमित रूप से अपने पाठकों के लिए उपयोगी और मददगार जानकारी शेयर करता हूं। ❤️

Comments ( 14 )

  1. sarthak upadhyay

    nginx server par .htaccess aur robot.txt kaise access karenge sir

    Reply
    • Jumedeen khan

      Nginx .htaccess support nahi karta, aap nginx configuration file me code add kar sakte ho. Robots.txt yoast SEO plugin ke though create kar sakte ho.

      Reply
      • Sarthak Upadhyay

        Sir, migrate karne ke baad jo maine . Htaccess ko edit kiya tha aur plugins ke by default . htaccess kya apne aap kaam krenge.

        Migrate ke baad koi change krna hoga kya.

        Reply
        • Jumedeen khan

          Nginx par htaccess kaam nahi karta hai.

          Reply
  2. pradeep

    #Jdk… क्या Ubuntu 18.06 पर LEMP के लिए यही Same Configuration होगा .. ???

    Reply
    • Jumedeen khan

      Thoda different hai, main jaldi hi iski guideline share karne wala hu.

      Reply
      • Pradeep

        Thq sir #jdk…. साथ में Ubuntu 18.04 (LAMP) Server with ‘Adminer’ या ‘phpmyadmin’ database configure करने बताईये…

        Reply
      • Pradeep

        Thq sir. #jdk…साथ में Ubuntu 18.04 (LEMP) Server with ‘Adminer’ या’phpmyadmin’ database configure करने बताईये….

        Reply
  3. Rushikesh Sonawane

    Hello sir mujhe Digital Ocean me apne wordpress blog ko install karna hai. Meri Madat kijiye.

    Dekhiye maine abtak ek droplet create kiya hai. Sath putty(is tutorial) ko {sudo systemctl reload nginx} > is step ko follow bhi kiya. Lekin create a PHP file to configure yah step bilkul hi samh nahi aayi.

    Sath hi sir yah bataye. droplet creat kiya. sudo systemctl reload nginx < yahatak puri process bina error ki hai. Ab aage kya? Matlab kaise domain athva name sever add karna hai. WordPress kaise install karu aur backup kahapar upload karte hai.

    Sir ek aur baat, me is problem ke liye kisi se help le raha tha. To usane mujhe nameserver add karne se pahale puch ki domain kahase liya. To maine kaha godaddy. To usane mujhe cloudflare CDN ka account banane ke liye kaha hai. Kya yah jaruri hai.

    Sir bahot confusion ho raha hai. plz help me. Maine aapko bataya ki abtak maine kya ab next step bataye plz.

    Reply
    • Jumedeen khan

      PHP file isiliye create karke dekhte hai taki jaan sake ki installation sahi se hua hai ya nahi. I will do it for you.

      Reply
      • Rushikesh Sonawane

        Oh I understood your willing of help. But I really don’t have budget.

        Reply
        • Jumedeen khan

          No worry dear, just give me sometime I will share complete guide.

          Reply
  4. suraj vaghela

    Sir Muje Meri Website GoDaddy Shared Hosting se DigitalOcean me Transfer Karni he Kaise Karu Please Batayiye.

    Reply
    • Jumedeen khan

      First aap godaddy hosting se blog ka backup le lo fir digitalocean server par wordpress install kar backup import karo.

      Reply

Leave a Comment

I need help with ...