Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Setting Up LEMP Linux, Nginx, MySQL/MariaDB, PHP) and PhpMyAdmin on Ubuntu 15.04 Server
LEMP stack is a powerful combination of open source technologies used for web development and hosting. LEMP comprises Linux (the operating system), Nginx (pronounced "engine-x", a web server), MySQL/MariaDB (database management), and PHP (server-side scripting language).
Note: Ubuntu 15.04 has reached end-of-life. This guide is for educational purposes. Consider using a current Ubuntu LTS version for production environments.
Prerequisites
Before starting the installation, ensure you have
- Ubuntu 15.04 server with root or sudo access
- Internet connection for package downloads
- Basic command line knowledge
Manual Installation Method
Step 1: Update System Packages
First, update your package repositories
sudo apt-get update sudo apt-get upgrade
Step 2: Install Nginx Web Server
Install and start Nginx
sudo apt-get install nginx sudo systemctl start nginx sudo systemctl enable nginx
Step 3: Install MySQL Database
Install MySQL server and secure the installation
sudo apt-get install mysql-server sudo mysql_secure_installation
Step 4: Install PHP and Required Modules
Install PHP-FPM and necessary extensions
sudo apt-get install php5-fpm php5-mysql php5-curl php5-gd php5-mcrypt
Step 5: Configure Nginx for PHP
Edit the default Nginx configuration
sudo nano /etc/nginx/sites-available/default
Add the following PHP location block
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Restart Nginx and PHP-FPM
sudo systemctl restart nginx sudo systemctl restart php5-fpm
Step 6: Install PhpMyAdmin
Install PhpMyAdmin for database management
sudo apt-get install phpmyadmin sudo ln -s /usr/share/phpmyadmin /var/www/html/
Step 7: Test Installation
Create a test PHP file
<?php phpinfo(); ?>
Save this as /var/www/html/info.php and access it via browser at http://your-server-ip/info.php.
Security Considerations
| Component | Security Action | Purpose |
|---|---|---|
| MySQL | Run mysql_secure_installation | Remove test databases and secure root account |
| PHP | Disable dangerous functions | Prevent code execution vulnerabilities |
| Nginx | Configure proper file permissions | Restrict unauthorized access |
Verification Steps
To verify your LEMP stack is working correctly
- Access
http://your-server-ipto see Nginx welcome page - Visit
http://your-server-ip/info.phpto confirm PHP is working - Access
http://your-server-ip/phpmyadminfor database management
Conclusion
You have successfully set up a complete LEMP stack with PhpMyAdmin on Ubuntu 15.04. This environment provides a robust foundation for hosting dynamic websites and web applications with efficient database management capabilities.
