Setup VPS Linux Server Ubuntu 20.04 LTS untuk aplikasi Laravel secara manual
•
2 min read
Kali ini kita akan menjelaskan bagaimana cara setup ubuntu server 20.04 secara manual agar dapat menjalankan aplikasi laravel
operating system
Ubuntu 20.04 LTS
server preparation
- install acl
- install nginx
- install php
- install composer
- install mysql server
- install git
- install redis server
install acl
apt install acl
install nginx
apt install nginx
install php
apt install software-properties-commonadd-apt-repository ppa:ondrej/phpapt install php8.0 php8.0-fpm php8.0-mysql php8.0-common php8.0-cli php8.0-cgi php8.0-curl php8.0-gd php8.0-mbstring php8.0-intl php8.0-sqlite3 php8.0-xsl php8.0-xml php8.0-zip php8.0-memcached php8.0-opcache
install composer
- buat shell file
install-composer.sh
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT
- chmod +x
install-composer.sh - run
./install-composer.sh - mv composer.phar /usr/bin/composer
install mysql server
apt install mysql-servermysql -uroot -pif password is asked just enter- jalankan script ini untuk membuat user baru dan database baru
create user 'ubuntu';
grant all privileges on *.* to 'ubuntu' with grant option;
flush privileges;
alter user ubuntu identified with mysql_native_password by 'secret';
create database envoy;
install git
apt install git
install redis server
apt install redis server
nginx configuration
- backup /etc/nginx/sites-available/default
- adjust default config
root /var/www/app2/current/public;
index index.html index.htm index.nginddx-debian.html index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
location ~ /.ht {
deny all;
}