Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Last active March 30, 2023 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanusdad/24155b97cffe26fd13bbd46fea54f904 to your computer and use it in GitHub Desktop.
Save nanusdad/24155b97cffe26fd13bbd46fea54f904 to your computer and use it in GitHub Desktop.
Installing Drupal 10 on Ubuntu 20.04
server {
listen 80;
root /var/www/html/drupal;
index index.php index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Installing Drupal 10 on Ubuntu 20.04

Check version and apt update

lsb_release -a
sudo apt update && sudo apt upgrade

Install nginx and create directory

sudo apt install nginx
sudo mkdir /var/www/html/drupal

Adding PHP 8 repository

sudo vi /etc/apt/sources.list

Append the lines below to /etc/apt/sources.list

deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main

#deb-src https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main

Add key and install PHP 8

sudo apt-key adv --keyserver hkps://keyserver.ubuntu.com:443 --keyserver-options http-proxy=http://your_own_proxy:port --recv-keys 4f4ea0aae5267a6c
sudo apt update
sudo apt install php8.1
php -v

Installing PHP extensions

sudo apt install php8.1-fpm
sudo apt install php8.1-dom
sudo apt install php8.1-gd
sudo apt install php8.1-dba
sudo apt install php8.1-mysql
sudo apt install php8.1-mbstring

Download and extract Drupal 10

cd /tmp
wget https://www.drupal.org/download-latest/tar.gz
cd /var/www/html/drupal
tar xfvz /tmp/drupal-10.0.4.tar.gz

Configure NGINX and restart

/etc/nginx/sites-available/drupal.conf 
# sample provided in drupal.conf
sudo systemctl stop nginx
sudo systemctl start nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment