Hi,

I have tried to install Drupal 11 following the installation docs, but it is not quite working.

What's not working

First, all JS and CSS assets are missing. According to the browser dev tools, they just 404. On the web server in the directory web/sites/default/files, there is just a config_* folder, but no js_* or css_* folder, which the drupal installation is trying to access.

Second, clicking any link that leads to a Clean URL inside the installation (like localhost/user/login) also just gives a 404 error. According to the Clean URL documentation and the requirements documentation, it seems like no special setting is needed for Nginx.

What I did exactly

After removing the database and the installation directory, I tried to set up a clean install like this:

  • mariadb -u root -e "CREATE DATABASE drupal11;"
  • mariadb -u root -e "CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON drupal11.* TO 'drupaluser'@'localhost'; FLUSH PRIVILEGES;"
  • composer create-project drupal/recommended-project myproject
  • cd myproject
  • composer require drush/drush
  • composer remove drupal/core-project-message

Then, I just pointed Nginx to the web directory and opened it in a browser. I followed all installation instructions, input the database credentials, and there were no errors. After some time, I am redirected to the default theme which has the aforementioned issues.

Versions

  • Drupal 11.1.0
  • PHP 8.3
  • Nginx 1.24.0
  • Ubuntu 24.04.1 LTS

Any ideas? Help is much appreciated, thanks!

Comments

daoductrung’s picture

Based on my experience, the issue likely comes from:
1. File permissions: Drupal can’t write CSS/JS files.
• Fix: Run these commands. Just an example:
sudo chown -R www-data:www-data web/sites/default/files
sudo chmod -R 755 web/sites/default/files
2. Nginx missing rewrite rules: Clean URLs aren’t working.
• Fix: Add this to your nginx.conf. Just an example:
location / {
try_files $uri /index.php?$query_string;
}
• Reload Nginx:
sudo nginx -t && sudo systemctl reload nginx

ressa’s picture

Is this for the server or local development?

dvmc’s picture

It turns out that the nginx config file was missing this:

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php-fpm.sock;
    include fastcgi.conf;
}

Or, more precisely:

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param REQUEST_METHOD $request_method;
}

File permissions were correct and the try_files suggestion from this thread unfortunately didn't work either.

This is on a server. I debugged the issue by starting a DDEV environment (type drupal, webserver type nginx-fpm), comparing the web server config, and some trial-and-error.

Apologies for the late reply and thank you to everyone for their input.