Skip to content

Instantly share code, notes, and snippets.

@sidben
sidben / server-setup-php74.sh
Last active October 25, 2022 17:57
Script to setup NGINX / PHP for Laravel projects on AWS EC2 instances running Ubuntu (20.04)
#!/bin/bash
sudo apt update -y && sudo apt upgrade -y
sudo apt install zip unzip certbot python3-certbot-nginx software-properties-common -y
# AWS
sudo apt install awscli -y
# Remove Apache, Install NGINX
sudo systemctl stop apache2 && sudo systemctl disable apache2
sudo apt remove apache2 -y
@sidben
sidben / webapp.conf
Last active May 11, 2022 16:41
Nginx virtual host config for Laravel app with PHP 7.4
log_format custom '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent $request_time '
'"$http_referer" "$http_user_agent"';
server {
listen 80;
server_name _;
root /var/www/html/public;
@sidben
sidben / performance.cnf
Last active May 10, 2022 19:46
MySQL config
[mysqld]
performance_schema = off
@sidben
sidben / fastcgi.conf
Last active January 15, 2024 12:41
Nginx config for Laravel or Wordpress app with PHP 8.1
# This file should be published on
# /etc/nginx/modules-available/fastcgi.conf
##
# FastCGI cache
##
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=wpcache:200m max_size=10g inactive=2h use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;