What Nginx configuration should I use for Taskify?

What Nginx configuration should I use for Taskify?

Answer: Use this Nginx configuration to properly serve your Taskify application with PHP-FPM support.

Basic Nginx Configuration:

server {
    listen 80;
    server_name your_domain.com;
    root /path/to/taskify/public;

    index index.php index.html;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

SSL Configuration:

server {
    listen 443 ssl http2;
    server_name your_domain.com;
    root /path/to/taskify/public;

    ssl_certificate /path/to/your/certificate.crt;
    ssl_certificate_key /path/to/your/private.key;

    index index.php index.html;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Important Notes:

  • Update the PHP-FPM socket path for your PHP version
  • Ensure the document root points to the public directory
  • Test the configuration before applying
  • Restart Nginx after making changes