Score:-2

All pages give 404 using nginx

cn flag

I am building a drupal site with drupal 9, and i want to publish it using azure devops.

Only the problem is that every page, except the frontpage, gives a 404 error. I've looked around the internet, and most people say they miss the .htaccess file, it is however included.

I can't edit files directly, and have to change it locally and then commit to change them, but it does somehow work locally.

The drupal files (including the htaccess file) are in a folder 'src'.

Does anybody know how to fix this?

Edit: The server is nginx

cn flag
Is it an Apache server?
syter avatar
cn flag
It is on nginx. On apache it works
Score:2
cn flag

Nginx can’t process htaccess files without a specific extension installed.

You either need to install that extension or manually configure nginx to work with Drupal.

There’s an example config here if you go down the manual route: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

syter avatar
cn flag
For the record, you mean 'php-fpm' as the extension?
cn flag
No, there’s actually an extension for nginx which will make it understand htaccess - https://github.com/e404/htaccess-for-nginx. PHP-FPM is an extension that comes with PHP (which exposes a socket or TCP endpoint or socket for other processes like nginx to execute PHP commands). FPM won’t help with the rewrite rules, for that you need to configure nginx
syter avatar
cn flag
Ah alright, thank you very much. i will try it :)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.