Skip to content

Instantly share code, notes, and snippets.

@morshadunnur
Created December 18, 2016 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morshadunnur/695e46c537f450bef891b4812d1e5cc2 to your computer and use it in GitHub Desktop.
Save morshadunnur/695e46c537f450bef891b4812d1e5cc2 to your computer and use it in GitHub Desktop.
Install LEMP-(Linux Nginx MySQL PHP ) stack on Ubuntu 16.04
#The LEMP software stack is a group of software that can be used in dynamic websites and web Application. This is an acronym that describes a Linux operating system with an Nginx Web Server. MySQL database stored the data and dynamic data handled by PHP.
#Imstall Nginx as web server
$ sudo apt-get update //update our local index packages
$ sudo apt-get install nginx
# If ufw firewell running we need to allow cooection to nginx.We can enable this by this
$ sudo ufw allow 'Nginx HTTP'
# MySQL Installation
$ sudo apt-get install mysql-server
#To secure root connection
$ sudo mysql_secure_installation
# Install PHP for Processing
$ sudo apt-get install php7.0-fpm php7.0-mysql
// Fix the settings of php.ini
$ sudo nano /etc/php/7.0/fpm/php.ini
***Find the cgi.fix_pathinfo and put out semicolon and set the value 0
# Restart the PHP Processor
$ sudo systemctl restart php7.0-fpm
// Configure Nginx to use PHP Processor
$ sudo nano /etc/nginx/sites-available/default
# Write this-
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name localhost;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
# Test the Connection
$ sudo nginx -t
# Reload the nginx settings
$ sudo systemctl reload nginx
Go 127.0.1.1 and Enjoy !
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment