wiki icon indicating copy to clipboard operation
wiki copied to clipboard

Final setup page returns blank with 404 errors

Open Flatlyn opened this issue 6 years ago • 4 comments

I'm trying to run a wiki.js instance on my Ubunutu 18.04.3 LTS server using a Nginx reverse proxy. I used the Nginx config generator at DigitalOcean to generate the reverse proxy config files and that part seems to be working fine. The files for the server are in /var/www/site/wiki. When I run node server it starts the server no problem but says to head to http://localhost:3000 to continue the setup. When I try to connect to the sites domain, however, it fails to load the setup page with a serious of 404 errors—Nginx is passing the proxy connection, though as the page title is set correctly as "Wiki.js Setup".

These are the error's being returned

[Error] Failed to load resource: the server responded with a status of 404 () (setup.0f36c8857e987ef851bf.css, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (runtime.79e192f68c7933313fc5.js, line 0)
[Error] Refused to execute https://example.com/js/runtime.79e192f68c7933313fc5.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.
[Error] Failed to load resource: the server responded with a status of 404 () (setup.0f36c8857e987ef851bf.js, line 0)
[Error] Refused to execute https://example.com/js/setup.0f36c8857e987ef851bf.js as script because "X-Content-Type: nosniff" was given and its Content-Type is not a script MIME type.

I've reinstalled wiki.js clean in case it was a bad install.

OS: Ubunutu 18.04.3 LTS Wiki.js version: 2.0.12 Database engine: Postgres 10.10

Flatlyn avatar Dec 22 '19 19:12 Flatlyn

Looks like a misconfiguration in your nginx reverse proxy. Make sure js files can be accessed as well.

NGPixel avatar Dec 22 '19 21:12 NGPixel

The Nginx config was taken from nginxconfig.io, but checking it against other sources I'm not sure what could be wrong as it seems to be right for a reverse proxy to the node server running on port 3000

server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        server_name example.com;

        # SSL
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

        # security
        include nginxconfig.io/security.conf;

        # reverse proxy
        location / {
                proxy_pass http://127.0.0.1:3000;

                # This next block is actually include with a include 
                # nginxconfig.io/proxy.conf call but this is the contents of that file

                proxy_http_version      1.1;
                proxy_cache_bypass      $http_upgrade;

                proxy_set_header Upgrade                        $http_upgrade;
                proxy_set_header Connection             "upgrade";
                proxy_set_header Host                           $host;
                proxy_set_header X-Real-IP                      $remote_addr;
                proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto      $scheme;
                proxy_set_header X-Forwarded-Host       $host;
                proxy_set_header X-Forwarded-Port       $server_port;
        }

        # additional config
        include nginxconfig.io/general.conf;
}

# subdomains redirect
server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;

        server_name *.example.com;

        # SSL
        ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

        return 301 https://example.com$request_uri;
}

# HTTP redirect
server {
        listen 80;
        listen [::]:80;

        server_name .example.com;

        include nginxconfig.io/letsencrypt.conf;

        location / {
                return 301 https://example.com$request_uri;
        }
}

The wiki.js archive was downloaded into /var/www/ and then extracted into /var/www/wiki as per the install guide. That left me with the following structure:

wiki
  -assets  
  -config.yml  
  -LICENSE  
  -node_modules  
  -package.json  
  -server

I've then been running node server while inside the wiki directory. I've never used node before so I'm sure there is something I'm doing wrong, but I have no idea what.

Flatlyn avatar Dec 23 '19 01:12 Flatlyn

Hi

I had exactly the same problem And thix nginx config proxy work

 server {
   listen *:443;

   server_name wiki.mydomain.org;

   ssl    on;
   ssl_certificate    /etc/ssl/xxxxxxx;
   ssl_certificate_key    /etc/ssl/xxxxxxx;

   server_tokens off;
   proxy_set_header Host      $http_host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";
   proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forward-Proto http;
   proxy_set_header X-Nginx-Proxy true;
   proxy_redirect off;
   location / { proxy_pass  http://127.0.0.1:9014; }
}

server {
  listen *:80;
  server_name wiki.mydomain.org;
  return 301 https://wiki.mydomain.org$request_uri;

}

elapse-d avatar Jan 08 '20 10:01 elapse-d

I have these error too

And a blank page

DanitRosenberg avatar Nov 10 '20 12:11 DanitRosenberg