I try to use Magento 2.4.1 + FastCGI (Nginx + PHP-FPM), but I get 404 error for every page.

PHP 7.4.15

MySQL 8.0.23

Nginx 1.16.1

Ubuntu 18.04

Nginx conf:

server {
    server_name mysite.com www.mysite.com;
    fastcgi_buffers 128 512k;
    fastcgi_buffer_size 512k;
    proxy_buffer_size 512k;
    proxy_buffers 128 512k;
    proxy_busy_buffers_size 512k;
    fastcgi_connect_timeout 6000;
    fastcgi_send_timeout 6000;
    fastcgi_read_timeout 6000;
    proxy_connect_timeout 6000;
    proxy_send_timeout 6000;
    proxy_read_timeout 6000;
    send_timeout 6000;
    charset UTF-8;
    index index.php index.html;
    disable_symlinks if_not_owner from=$root_path;
    include /etc/nginx/vhosts-includes/*.conf;
    include /etc/nginx/vhosts-resources/mysite.com/*.conf;
    access_log /var/www/httpd-logs/mysite.com.access.log;
    error_log /var/www/httpd-logs/mysite.com.error.log notice;
    set $root_path /var/www/www-root/data/www/mysite.com;
    root $root_path;
    listen 178.XX.XXX.XX:80;
    listen [2a03:XXXX:XX:XX::]:80;
    gzip on;
    gzip_comp_level 9;
    gzip_disable "msie6";
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
    location / {
        location ~ [^/]\.ph(p\d*|tml)$ {
            try_files /does_not_exists @php;
        location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
            expires max;
    location @php {
        fastcgi_index index.php;
        fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
        fastcgi_pass unix:/var/www/php-fpm/www-root.sock;
        fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
        try_files $uri = 404;
        include fastcgi_params;

And many errors in web-console: enter image description here

I am newbee in it. Could you please help me?

1 Answer 1


Older question, but when you are missing static content, you need to run

php bin/magento setup:static-content:deploy 

Not sure about 404 for every page, you are hitting the main index.php file for magento in order to be looking for the static content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.