After using nginx to index the page, I opened the page and followed the prompts to enter my administrator user information and database-related information. Then I clicked Install and received a 404 error

After I installed it, I saw that the contents of *config/config.php had been changed to the content I configured in the webpage
This is my directory permission

root@arm:/var/www/html/nextcloud# ll /var/www/html/nextcloud/
total 1260
drwxr-xr-x 14 www-data www-data    4096 Jul 25 05:51 ./
drwxr-xr-x  3 root     root        4096 Jul 25 05:42 ../
-rwxr-xr-x  1 www-data www-data    4084 Jul 25 05:54 .htaccess*
-rwxr-xr-x  1 www-data www-data     101 Jul 18 11:33 .user.ini*
drwxr-x--- 44 www-data www-data    4096 Jul 18 11:39 3rdparty/
-rwxr-xr-x  1 www-data www-data   23796 Jul 18 11:33 AUTHORS*
-rwxr-xr-x  1 www-data www-data   34520 Jul 18 11:33 COPYING*
drwxr-x--- 51 www-data www-data    4096 Jul 18 11:34 apps/
-rwxr-xr-x  1 www-data www-data    2079 Jul 18 11:33 composer.json*
-rwxr-xr-x  1 www-data www-data    3140 Jul 18 11:33 composer.lock*
drwxrwxr-x  2 www-data www-data    4096 Jul 25 06:39 config/
-rwxr-xr-x  1 www-data www-data    4145 Jul 18 11:33 console.php*
drwxr-x--- 24 www-data www-data    4096 Jul 18 11:39 core/
-rwxr-xr-x  1 www-data www-data    8497 Jul 18 11:33 cron.php*
drwxr-x---  3 www-data www-data    4096 Jul 25 05:54 data/
drwxr-x---  2 www-data www-data   16384 Jul 18 11:33 dist/
-rwxr-xr-x  1 www-data www-data     156 Jul 18 11:33 index.html*
-rwxr-xr-x  1 www-data www-data    4564 Jul 18 11:33 index.php*
drwxr-x---  6 www-data www-data    4096 Jul 18 11:33 lib/
-rwxr-xr-x  1 www-data www-data     283 Jul 18 11:33 occ*
drwxr-x---  2 www-data www-data    4096 Jul 18 11:33 ocs/
drwxr-x---  2 www-data www-data    4096 Jul 18 11:33 ocs-provider/
-rwxr-xr-x  1 www-data www-data 1072073 Jul 18 11:33 package-lock.json*
-rwxr-xr-x  1 www-data www-data    7002 Jul 18 11:33 package.json*
-rwxr-xr-x  1 www-data www-data    3759 Jul 18 11:33 public.php*
-rwxr-xr-x  1 www-data www-data    5597 Jul 18 11:33 remote.php*
drwxr-x---  4 www-data www-data    4096 Jul 18 11:33 resources/
-rwxr-xr-x  1 www-data www-data      26 Jul 18 11:33 robots.txt*
-rwxr-xr-x  1 www-data www-data    2523 Jul 18 11:33 status.php*
drwxr-xr-x  3 www-data www-data    4096 Jul 18 11:33 themes/
drwxr-x---  2 www-data www-data    4096 Jul 18 11:34 updater/
-rwxr-xr-x  1 www-data www-data     383 Jul 18 11:39 version.php*
root@arm:/var/www/html/nextcloud# ll /var/www/html/nextcloud/config/config.php
-rw-r----- 1 www-data www-data 632 Jul 25 05:54 /var/www/html/nextcloud/config/config.php

This is my nginx configuration

server {
    listen 80;
    server_name my.domainname.com; 

    # Redirect all HTTP requests to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 1000 ssl;
    server_name my.domainname.com; 

    ssl_certificate /root/cert.crt;
    ssl_certificate_key /root/pkey.key;

    root /var/www/html/nextcloud/;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ =404;
    }

    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;
    }

    location ~* \.(?:css|js|png|jpg|jpeg|gif|ico|svg)$ {
        try_files $uri =404;
        expires 30d;
        access_log off;
    }

    location ~ /\.ht {
        deny all;
    }
}

This is the certificate permission

root@arm:/var/www/html/nextcloud# ll /root/cert.crt
-rw-r--r-- 1 root root 4112 Jul 24 09:04 /root/cert.crt
root@arm:/var/www/html/nextcloud# ll /root/pkey.key
-rw-r--r-- 1 root root 227 Jul 24 09:04 /root/pkey.key
root@arm:/var/www/html/nextcloud#

There are no obvious errors in PHP-FPM, Nextcloud logs, or nginx logs

Automatically jump to/index. php/apps/dashboard/

hi @LuYue welcome to the forum :handshake:

please use code ``` marks to improve code readability (there is a code button as well </>!

if you get 404 error on the client there must be corresponding log entry in your webserver or application log (nextcloud.log) or maybe reverse proxy if you use one.

Please review official NGINX configuration docs

does it mean 404 occurs when there is a redirect to ../index.php/apps/dashboard ?

1 Like

No idea where you got that Nginx configuration, but it’s massively incomplete for Nextcloud. Please read the Installation chapter covering Nginx in the Admin Manual: NGINX configuration — Nextcloud latest Administration Manual latest documentation