• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

NGINX Error

Scheduled Pinned Locked Moved General Discussion
nginxerrornodebb
21 Posts 7 Posters 12.4k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    termnml
    wrote on last edited by
    #9

    The location for the files is prepended by a /.
    For your aim it has to be removed. source

    <link rel="stylesheet" type="text/css" href="/stylesheet.css?xxxxx">
    

    to

    <link rel="stylesheet" type="text/css" href="stylesheet.css?xxxxx">
    

    For this to work code would have to be rewritten. Good luck with this.

    Why do you want to make your live harder with constantly avoiding subdomains.
    They are much cleaner. And I think "the officials" will not come to "rescue" you.

    1 Reply Last reply
    0
  • A Offline
    A Offline
    a_5mith
    replied to lenovouser on last edited by
    #10

    @silasrech To add to what @termnml has said, My default instinct was to recommend you use a subdomain, as I'm not 100% that subfolders are really "supported". But I'm sure someone will give you a definitive answer. Unfortunately I'm also not really official. 😛 Have a read through this topic it contains some config settings etc to get it working as a subfolder.

    1 Reply Last reply
    1
  • ShardS Offline
    ShardS Offline
    Shard
    wrote on last edited by Shard
    #11

    Any correctly matched, arbitrary , location block should work.

    If I was better at them, I'd provide an example. 🙂 Sorry.

    Fortunately, there are much smarter people than I out there who have done this - with Ghost. You should be able to use this while only changing the target port.

    http://www.allaboutghost.com/how-to-install-ghost-in-a-subdirectory/

    An alternate hack would be to put a redirect on a subdirectory location block sending it to the subdomain config. Kinda fugly, but. 🙂

    1 Reply Last reply
    1
  • lenovouserL Offline
    lenovouserL Offline
    lenovouser
    wrote on last edited by lenovouser
    #12

    After one year and diving deep into NGINX configuration and Node development I've finally found a solution for using subfolders with NGINX and NodeBB:

    NGINX configuration:

    server {
        listen 443 ssl;
        listen 80;
        listen [::]:443 ssl;
        listen [::]:80;
        server_name domain.tld;
        index index.html;
        location ^~ /community {
            proxy_set_header X-Real-IP         $remote_addr;
            proxy_set_header Referer           $http_referer;
            proxy_set_header Host              $host;
            proxy_set_header Cookie            $http_cookie;
            proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Host  $host;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Port  $server_port;
            proxy_set_header X-NginX-Proxy     true;
            proxy_redirect                     off;
            proxy_http_version                 1.1;
            proxy_pass                         http://localhost:<port>;
        }
        location / {
             // stuff for your main app
        }
    }
    

    NodeBB configuration part:

    {
        "url": "https://domain.tld/community"
    }
    
    ? PitaJP G 3 Replies Last reply
    2
  • ? Offline
    ? Offline
    A Former User
    replied to lenovouser on last edited by
    #13

    @lenovouser it is already mentioned in the documentation, if I am not mistaken.

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to lenovouser on last edited by
    #14

    @lenovouser Yeah, I got that working pretty easily based on the docs. I did change from that to using a subdomain, though, because it just makes relative urls much easier.

    1 Reply Last reply
    0
  • lenovouserL Offline
    lenovouserL Offline
    lenovouser
    wrote on last edited by
    #15

    I can't find it in the documentation. You also find a lot of people asking for it, like me, if you search for it:

    search:subfolder

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to lenovouser on last edited by PitaJ
    #16

    @lenovouser here it is

    Edit: while that doesn't explain it entirely, you really only need to change the location in the Nginx and the URL in the config.

    1 Reply Last reply
    0
  • lenovouserL Offline
    lenovouserL Offline
    lenovouser
    wrote on last edited by
    #17

    Hm.

    Just changing

    location /
    

    to

    location /community
    

    will definitely not work. I've tried that. You need the ^~ to make it work.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to lenovouser on last edited by
    #18

    @lenovouser it worked for me first time. There must be something else going on with your configuration. Maybe it's the SSL or something, since my test server was just running on 80.

    1 Reply Last reply
    0
  • lenovouserL Offline
    lenovouserL Offline
    lenovouser
    wrote on last edited by
    #19

    Might be, but I don't know how SSL should interfere with location blocks. Might spin a droplet up sometime later this day and test it.

    1 Reply Last reply
    0
  • lenovouserL Offline
    lenovouserL Offline
    lenovouser
    wrote on last edited by
    #20

    Actually, you see what the error is if you look at my first 2 posts.

    1 Reply Last reply
    0
  • G Offline
    G Offline
    giantkingsquid
    replied to lenovouser on last edited by giantkingsquid
    #21

    @lenovouser Your method works fine for me over https. Thanks for your persistence.

    edit: I just had to add in these two lines for socket.io to work.
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development