sajad torkamani

Clone Git repo on server

SSH into your Ubuntu server and clone the Git repo into a desired location. Let's assume:

  • Git repo is
  • Repo location in filesystem is /home/sajad/sites/wordpress-deployer-example
# /home/sajad/sites/wordpress-deployer-example
git clone

Create Nginx config

sudo vim /etc/nginx/sites-available/

Set its contents to:

server {
    listen 80;
    root /home/sajad/sites/wordpress-deployer-example/current;

    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    error_page 404 /index.php;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.0-fpm.sock; # Change as needed
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;

    location ~ /\.ht {
        deny all;

This config assumes you've already configured your DNS records to point to your server's public IP address. Also note that if using a long server name like in the above config, you'll want to edit the Nginx config.

Activate config.

sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled

Reload nginx.

sudo nginx -s reload

Verify configuration

Now, visit and you should see the WordPress website.