Skip to content

Instantly share code, notes, and snippets.

@masitings
Last active October 26, 2019 18:56
Show Gist options
  • Save masitings/add13ae010e6abf8be5ea30d221c011f to your computer and use it in GitHub Desktop.
Save masitings/add13ae010e6abf8be5ea30d221c011f to your computer and use it in GitHub Desktop.
#Warming up
sudo apt update -y; sudo apt dist-upgrade -y; sudo apt autoremove -y;
#Install Nginx
sudo apt update -y; sudo apt install nginx -y;
#Restart Nginx
sudo systemctl stop nginx.service; sudo systemctl start nginx.service; sudo systemctl enable nginx.service
#Install MariaDB
sudo apt-get install mariadb-server mariadb-client
#Restart MariaDB
#16.04 LTS
sudo systemctl stop mysql.service; sudo systemctl start mysql.service; sudo systemctl enable mysql.service
#18.04 LTS
sudo systemctl stop mariadb.service; sudo systemctl start mariadb.service; sudo systemctl enable mariadb.service
#Install MariaDB
sudo mysql_secure_installation
#Install PHP7.2
sudo apt-get install software-properties-common; sudo add-apt-repository ppa:ondrej/php; sudo apt update -y; sudo apt install php7.2-fpm php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-zip php7.2-curl -y;
#PHP.INI Config
sudo nano /etc/php/7.2/fpm/php.ini;
--------------
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = Asia/Jakarta
-----------------------------------------------
EXTRA
-----------------------------------------------
#Adding domain / subdomain
- Copy the main `default` into your domain : example
`sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/domain.com.conf`
- Edit the domain.com.conf files.
- Link the config using this command :
`sudo ln -s /etc/nginx/sites-available/domain.com.conf /etc/nginx/sites-enabled/`
- Restart Nginx & PHP
`sudo systemctl restart nginx.service; sudo systemctl restart php7.2-fpm.service`
==============================================
Configuration Nginx for Laravel
==============================================
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name 107.191.44.91;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment