Step 1: Install Nginx HTTP Server On Ubuntu
Step 2: Install MySQL to Manage Site Data
Step 3: Install PHP7.2 and PHP7.2-FPM
Step 4: Configure Nginx PHP-FPM Settings
Step 5: phpMyAdmin
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx
sudo service nginx
sudo service nginx start
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
sudo apt-cache show php
sudo add-apt-repository ppa:ondrej/php
sudo apt-cache show php
sudo apt-get install php7.2-cli php7.2-fpm php7.2-curl php7.2-gd php7.2-mysql php7.2-mbstring zip unzip
php -v
sudo service php7.2-fpm status
sudo service php7.2-fpm start ###### (if the service isn't running already)
We now have our PHP components installed, but we need to make a slight configuration change to make our setup more secure.
sudo nano /etc/php/7.2/fpm/php.ini
What we are looking for in this file is the parameter that sets cgi.fix_pathinfo. This will be commented out with a semi-colon (;) and set to "1" by default.
This is an extremely insecure setting because it tells PHP to attempt to execute the closest file it can find if the requested PHP file cannot be found. This basically would allow users to craft PHP requests in a way that would allow them to execute scripts that they shouldn't be allowed to execute.
We will change both of these conditions by uncommenting the line and setting it to "0" like this:
/etc/php/7.0/fpm/php.ini
cgi.fix_pathinfo=0
Save and close the file when you are finished.
Next, open the Nginx site configuration file… by default it’s stored at /etc/nginx/sites-available/default
If you have a custom file, then edit it to enable Nginx PHP support. Run the commands below to open Nginx default site configuration file
sudo nano /etc/nginx/sites-available/default
Then uncomment or remove the # symbol on the highlighted lines below to enable Nginx PHP support.
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
}
ln -s /etc/nginx/sites-available/admin.nhanhviec.com /etc/nginx/sites-enabled/
sudo service nginx reload sudo service php7.2-fpm restart
touch /var/www/html/index.php
now open http://localhost and you should see the screen with all php informaiton
Vào thư mục www chứa nội dung website, chạy lệnh sau:
sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.4.14/phpMyAdmin-4.4.14-all-languages.tar.gz
Unzip:
sudo tar -xzvf phpMyAdmin-4.4.14-all-languages.tar.gz
sudo apt-get install php-mbstring php-gettext
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04
https://www.thuysys.com/server-vps/web-server/cai-nginx-mysql-php-lemp-tren-ubuntu-16-04.html
https://hackernoon.com/add-new-users-to-ec2-and-give-ssh-key-access-d2abd084f30c
https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04
https://medium.com/@asked_io/how-to-install-php-7-2-x-nginx-1-10-x-laravel-5-6-f9e30ee30eff
https://gist.github.com/GhazanfarMir/03bd1f1f770a3834d47274586d46ea62
https://websiteforstudents.com/installing-nginx-mariadb-on-ubuntu-16-04-17-10-18-04-with-php-7-2-support-lemp/
sudo apt-get update
sudo apt-get install git
issue 1 Can't update composer(ubuntu 16.04)
- Installation request for phpoffice/phpexcel 1.8.0 -> satisfiable by phpoffice/phpexcel[1.8.0].
- phpoffice/phpexcel 1.8.0 requires ext-xml * -> the requested PHP extension xml is missing from your system.
https://askubuntu.com/questions/865442/cant-update-composerubuntu-16-04
sudo apt-get install php7.2-xmlrpc php7.2-xml
issue 2 To install GMP on PHP7 on Ubuntu:
Run: sudo apt-get install php7.2-gmp
And add the following to php.ini:
extension=php_gmp.so