Cara Install LEMP di Server
Saya menggunakan server Debian kerana hampir sama dengan Raspbian pada Raspberry Pi LAMP Web Server. LEMP bermaksud (L) Linux operating System, (E) Nginx web server, (M) MariaDB database dan (P) PHP.
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install nginx $ systemctl status nginx $ sudo apt install php-fpm php-mysql php-zip php-gd php-xml php-xmlrpc php-curl php-intl php-mbstring php-soap $ sudo mkdir -p /var/www/your_domain $ sudo chown -R www-data:www-data /var/www/your_domain $ sudo chmod -R 755 /var/www/your_domain $ nano /var/www/your_domain/index.html
Masukkan source code untuk index.html
<html> <head> <title>Welcome to your_domain</title> </head> <body> <h1>Success! Your Nginx server is successfully configured for <em>your_domain</em>.</h1> <p>This is a sample page.</p> </body> </html>
$ nano /etc/nginx/sites-available/your_domain
server { listen 80; listen [::]:80; root /var/www/your_domain; index index.php index.html index.htm; server_name your_domain; location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; } }
$ sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/ $ sudo nano /etc/nginx/nginx.conf Remove # for server_names_hash_bucket_size $ sudo nginx -t $ sudo systemctl restart nginx $ sudo apt install mariadb-server $ sudo mysql_secure_installation $ sudo mysql -u root -p $ create database exampledb; $ create user 'exampleuser'@'localhost' identified by 'examplepassword'; $ grant all privileges on exampledb.* to 'exampleuser'@'localhost'; $ flush privileges; $ quit
Database management boleh menggunakan adminer.
$ cd /var/www/html $ sudo mkdir adminer $ cd adminer $ sudo wget http://www.adminer.org/latest-mysql-en.php $ sudo mv latest-mysql-en.php index.php
Rujukan lain:
Leave a Reply