How To Install Linux, Nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04
How To Install Linux, Nginx, MySQL, PHP (LEMP) stack on Ubuntu 14.04
If you're looking to set up a web server, the LEMP stack is a popular choice. LEMP stands for Linux, Nginx, MySQL, and PHP, and it provides a solid foundation for hosting websites and web applications. In this tutorial, we'll walk through the steps to install LEMP on Ubuntu 14.04.
Step 1: Install Linux
The first step is to install Ubuntu 14.04. You can download the ISO file from the Ubuntu website and burn it to a DVD or USB drive. Once you've booted from the installation media, follow the on-screen instructions to install Ubuntu on your system.
Step 2: Install Nginx
Nginx is a lightweight and high-performance web server that's well-suited for serving static content. To install Nginx on Ubuntu 14.04, run the following commands in the terminal:
sudo apt-get update
sudo apt-get install nginx
Once Nginx is installed, you can start and stop the server using the following commands:
sudo service nginx start
sudo service nginx stop
Step 3: Install MySQL
MySQL is a popular open-source relational database management system. To install MySQL on Ubuntu 14.04, run the following command:
sudo apt-get install mysql-server
During the installation process, you'll be prompted to set a root password for MySQL. Make sure to choose a strong password and keep it safe.
Step 4: Install PHP
PHP is a server-side scripting language that's used to create dynamic web pages. To install PHP on Ubuntu 14.04, run the following command:
sudo apt-get install php5-fpm
Once PHP is installed, you'll need to configure Nginx to use it. Open the default Nginx configuration file:
sudo nano /etc/nginx/sites-available/default
Add the following lines inside the server block:
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
Save and exit the file, then restart Nginx:
sudo service nginx restart
Step 5: Test the Installation
To test your LEMP stack installation, create a file named info.php in the /usr/share/nginx/html directory:
sudo nano /usr/share/nginx/html/info.php
Add the following lines to the file:
<?php phpinfo(); ?>
Save and
Комментарии
Отправить комментарий