Running node-version with nginx in a suburl

452 views
Skip to first unread message

Hans Maulwurf

unread,
May 17, 2016, 9:33:07 AM5/17/16
to TiddlyWiki
Hey,

could someone help me to get TW5 working with nginx under a suburl? I run "tiddlywiki testwiki --server 8090 $:/core/save/all text/plain text/html "" "" 0.0.0.0"

Then i can access the tw fine with localhost:8090 or my dyndnsxxx:8090. But i want to get it at localhost/tiddly. I tried it with nginx-conf:

    location / {
alias /tiddly;
        proxy_pass   http://hansarch.ddns.info:8090;
        proxy_max_temp_file_size 0 ;
        proxy_set_header        Host             $host;
        proxy_set_header        X-Real-IP        $remote_addr;
        proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for;
    }

But i only get a white page. Any suggestions?

Thanks for ur help,

Hans

Matthew Lauber

unread,
May 17, 2016, 9:54:37 AM5/17/16
to TiddlyWiki
Is nginx running on the same box as tiddlywiki?  If so, you probably don't need to proxy_pass to ddns.info:8090 but rather to localhost:8090.

Here's my configuration
server {
    listen           80;
    access_log       /var/log/nginx/tiddlywiki.access.log combined;

    location /wiki/ {
        limit_except GET HEAD {
            auth_basic 'Restricted';
            auth_basic_user_file /etc/nginx/auth/tiddlywiki;
        }
        proxy_pass   http://127.0.0.1:8888/;
        proxy_set_header        Host             $host;
        proxy_set_header        X-Real-IP        $remote_addr;
        proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for; 
    }
}

As you can see, I'm proxying to localhost on port 8888.  My wiki is available below the path /wiki/ so you'd want to replace that with /tiddly/.

The one nice feature I figured out was how to restrict write access to logged in users, while allowing read access via the limit_except GET HEAD block.

Hope that helps,
Matt

Hans Maulwurf

unread,
May 17, 2016, 4:15:20 PM5/17/16
to TiddlyWiki
How do you start ur tw5?
my nginx-configuration looks like this, but i still get only a white page with console output:

logsimple.js:15 we are insidehttp://hansarch.ddns.info/tiddly

nginx.conf:
server {
    listen 80; # spdy is optional as well as ssl
    server_name localhost;

    client_max_body_size 80M;
    client_body_buffer_size     80M;

    root /srv/http;
    ## root /srv/http/paperwork/frontend/public;
    # index index.html index.php;


    location /tiddly {

        proxy_pass   http://127.0.0.1:8090;
        proxy_max_temp_file_size 0 ;
        proxy_set_header        Host             $host;
        proxy_set_header        X-Real-IP        $remote_addr;
        proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for;
    }


    location /tt-rss {
     #root /tt-rss;
     index index.html index.php;
        try_files $uri $uri/ /index.php;
        #fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        #fastcgi_index index.php;
        #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #include fastcgi_params;
#error_log  logs/ttrsserror.log;
#error_log  logs/ttrsserror.log  notice;
#error_log  logs/ttrsserror.log  info;
    }



    location ~ \.php {
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }



}

Hans Maulwurf

unread,
May 18, 2016, 9:19:49 AM5/18/16
to TiddlyWiki
When i use

    server {
      listen 90;
      server_name localhost;

      location / {

          proxy_pass   http://localhost:8090;
          proxy_set_header        Host             $host;
          proxy_set_header        X-Real-IP        $remote_addr;
          proxy_set_header        X-Forwarded-For  $proxy_add_x_forwarded_for;
      }

    }

i can access tw fine with http://localhost:90 but when i change to "location /tiddly" i am not able to access http://localhost:90/tiddly :( did i miss some parameter?

Matthew Lauber

unread,
May 18, 2016, 1:24:43 PM5/18/16
to TiddlyWiki
Have you tried 
a) visiting http://localhost:90/tiddly/ with the quoted config below.
b) changing the location to "/tiddly/" not "/tiddly" in the quoted config below.

Hans Maulwurf

unread,
May 18, 2016, 5:24:23 PM5/18/16
to TiddlyWiki
no matter if i use "/tiddly" or "/tiddly/" in the config, i always get a 404 and a blank white page when visiting http://localhost:90/tiddly"

but when i access a real false url like http://localhost:90, i get a page from nginx with a big black 404. So this means, something seems to lead me with localhost:90/tiddly to my tiddlywiki but the tiddlywiki says 404

is it possible that i am lead to http://localhost:8090/tiddly ?

Matthew Lauber

unread,
May 18, 2016, 10:04:49 PM5/18/16
to TiddlyWiki
I admit, I'm truly not sure.  You say you can still access it at http://hansarch.ddns.info:8090  ?  Beacuse that doesn't resolve at all for me.  Seems that the DNS record for that resolves to a local IP (192.168.2.100), which shouldn't work outside your home network.

Hans Maulwurf

unread,
May 19, 2016, 2:57:31 AM5/19/16
to TiddlyWiki
Resolving to a local IP is correct, I just want to use it inside my local network. I don't know why this simple proxy_pass stuff is not working. I just see, when I access http://localhost:8090/tiddly I get the same error 404 and a black white page. I'm using Arch Linux (Antergos), maybe nginx behaves different under this OS?

Hans Maulwurf

unread,
May 19, 2016, 5:18:59 AM5/19/16
to TiddlyWiki
a little step further:

now it's showing the tw5-page, but the sync seems to be broken, i get 405-error-windows every time it tries to save

location and proxy_pass with ending "/":

      location /tiddly/ {

          proxy_pass   http://localhost:8090/;

Matthew Lauber

unread,
May 19, 2016, 4:03:17 PM5/19/16
to TiddlyWiki
Ok, that one I think I can help with.  In the TiddlyFolder, go into tiddlers/ then look for a file named "$__config_tiddlyweb_host.tid" The content of it should look like this

created: 20141120211719165
modified: 20160518171746172
title: $:/config/tiddlyweb/host
type: text/vnd.tiddlywiki

$protocol$//$host$/wiki/

Mine is $protocol//$host$/wiki/ yours should be $protocol//$host$/tiddly/

Try, that, and let me know if you have issues.  However, I'll be out of town, so I may not see your messages till Monday.

Matt

Hans Maulwurf

unread,
May 20, 2016, 2:03:30 AM5/20/16
to TiddlyWiki
There is no file named like this. Do i have to install a tiddlyweb-plugin?

Matthew Lauber

unread,
May 20, 2016, 8:29:36 AM5/20/16
to TiddlyWiki
Try going to setttings and see if you have a server tab.  If you do you don't need to install anything, just create the file.  But you were able to save it before, when it was at the root?  If so, you should have everything you need.
Reply all
Reply to author
Forward
0 new messages