Monday, December 5, 2022
Arch linux MySQL Nginx PHP PHPmyadmin

Cara Install LEMP Stack di Arch Linux

LEMP

“Cara Install LEMP Stack di Arch Linux”

Pengantar

Tutorial ini akan memandu Anda dalam menginstal dan mengkonfigurasi tumpukan LEMP (Nginx, PHP, MySQL dengan mesin MariaDB dan PhpMyAdmin) dari jarak jauh menggunakan SSH, yang dapat memberikan dasar yang kuat untuk membangun Aplikasi Server Web.

Cara Install LEMP Stack di Arch Linux

Setting IP Static

# ip link
# cp /etc/netctl/examples/ethenet-static  /etc/netctl/static.ens33
# nano  /etc/netctl/static.ens33

Description='A basic static ethernet connection for ens33'
Interface=ens33
Connection=ethernet
IP=static
Address=('192.168.1.33/24')
Gateway='192.168.1.1'
Brodcast='192.168.1.255'
DNS=('192.168.1.1' '8.8.8.8')

# netctl start static.ens33
# netctl status static.ens33

# netctl enable static.ens33

# pacman -S net-tools

# ping youtube.com

# reboot

Install LEMP Stack

$ sudo pacman -Syu
$ sudo pacman –S openssh

$ sudo systemctl start sshd
$ sudo systemctl status sshd
$ sudo systemctl enable sshd
  • Install Nginx
$ sudo pacman -S nginx
$ sudo systemctl start nginx
$ sudo systemctl status nginx
$ sudo pacman -S mysql
$ sudo systemctl start mysqld
$ sudo systemctl status mysqld

- Config mysql

$ sudo mysql_secure_installation

- test login

# mysql -u root -p
$ sudo pacman –S php php-fpm
$ sudo systemctl start php-fpm
$ sudo systemctl status php-fpm

- cek list php

$ sudo pacman –S php[TAB]
$ sudo pacman –Ss | grep php
$ pacman -S phpmyadmin php-mcrypt
$ sudo ln -s /usr/share/webapps/phpMyAdmin   /usr/share/nginx/html
  • setup php ini
$ sudo nano /etc/php/php.ini

extension=mysqli.so
extension=mysql.so
extension=mcrypt.so
mysqli.allow_local_infile = On

open_basedir= /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/
  • Edit nginx
$ sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
$ sudo nano /etc/nginx/nginx.conf

#user html;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    gzip  on;

    server {
        listen       80;
        server_name  localhost;
            root   /usr/share/nginx/html;
        charset koi8-r;
        location / {
        index  index.php index.html index.htm;
                                autoindex on;
                                autoindex_exact_size off;
                                autoindex_localtime on;
        }

                                location /phpmyadmin {
        rewrite ^/* /phpMyAdmin last;
    }

 error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

    location ~ \.php$ {
        #fastcgi_pass 127.0.0.1:9000; (depending on your php-fpm socket configuration)
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;
    }

        location ~ /\.ht {
            deny  all;
        }
    }         
}
  • restart service
$ sudo systemctl restart php-fpm
$ sudo systemctl restart nginx

$ sudo systemctl enable php-fpm
$ sudo systemctl enable nginx
$ sudo systemctl enable mysqld
http://arch_IP/phpmyadmin 

Penutup

Baca Juga :  Cara Install PHP Composer pada Ubuntu 20.04 / Debian 11 / Linux Mint

Sahabat Blog Learning & Doing demikianlah penjelasan mengenai Cara Install LEMP Stack di Arch Linux. Semoga Bermanfaat . Sampai ketemu lagi di postingan berikut nya.

(Visited 25 times, 1 visits today)

Similar Posts