dje4321  
                
                  
                    February 25, 2018,  8:49am
                   
                  1 
               
             
            
              So im following this guide to setup a offline page for when the forum goes down for whatever reason but ive run into 2 issues. The two issues im running into are that nginx is not redirecting 502 errors to the offline page and when both discourse and nginx are running i cant reach the forums.
  
  
     
 
/etc/nginx/sites-available/default.confhttps://paste.fedoraproject.org/paste/e01vmM3pkI41nlZhzuDmuA/ 
/etc/nginx/nginx.confhttps://paste.fedoraproject.org/paste/B032qvRECjgrsvcjXCWc7g include /etc/nginx/site-available/*.conf; line because it would only load the default config
/var/discourse/containers/app.ymlhttps://paste.fedoraproject.org/paste/DQxhGWvfD7MBUyYWGTpqxQ/ 
Any tips or advice for what i might be doing wrong?
             
            
              2 Likes 
            
                
            
           
          
            
              
                fefrei  
              
                  
                    February 25, 2018,  9:44am
                   
                  2 
               
             
            
              Weird! Are you 100% sure you’re talking to the right Nginx, and it is indeed reading the configuration you provide? When in doubt, I tend to replace everything in location / with something like return 410; (or some other unusual status code), checking whether I’m really served that status code.
             
            
              2 Likes 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 25, 2018,  9:52am
                   
                  3 
               
             
            
              i am indeed talking to the right nginx. Replacing everything in location / with return 410 results in a 410 error code
             
            
              
            
           
          
            
              
                fefrei  
              
                  
                    February 25, 2018, 10:28am
                   
                  4 
               
             
            
              Hm, too bad, that’s always a nice and easy explanation 
Next, I’d try to debug this:
What happens if you try to access Discourse? What do the outer Nginx’s log files tell you about the request? Does anything show up in the log files withing Discourse’s container?
             
            
              1 Like 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 25, 2018, 10:35am
                   
                  5 
               
             
            
              Totally forgot logs were a thing XD
nginx access.log when i try and access the domain
REDACTED - - [25/Feb/2018:10:30:53 +0000] "GET / HTTP/1.1" 502 173 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" "-"
REDACTED - - [25/Feb/2018:10:30:54 +0000] "GET /service-worker-49bb49a79c0c56d327e5dc0c32ba4b6469a79f13f05a5e174c02f8cb5b1df7b3.js HTTP/1.1" 502 173 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0" "-"
error.log tells a different story
2018/02/25 10:30:54 [crit] 15312#15312: *15 connect() to unix:/var/discourse/shared/standalone/nginx.http.sock failed (13: Permission denied) while connecting to upstream, client: REDACTED server: forum.cubedcorps.net, request: "GET /service-worker-49bb49a79c0c56d327e5dc0c32ba4b6469a79f13f05a5e174c02f8cb5b1df7b3.js HTTP/1.1", upstream: "http://unix:/var/discourse/shared/standalone/nginx.http.sock:/var/www/errorpages/discourse_offline.html", host: "forum.cubedcorps.net"
nothing in the discourse logs
             
            
              
            
           
          
            
              
                fefrei  
              
                  
                    February 25, 2018, 10:51am
                   
                  6 
               
             
            
              Okay, so something about the socket is fishy. Does the file /var/discourse/shared/standalone/nginx.http.sock exist (while Discourse is running)?
Did you rebuild Discourse after modifying app.yml?
             
            
              1 Like 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 25, 2018, 10:53am
                   
                  7 
               
             
            
              
permission | size | owner | group | date | name
srw-rw-rw-@    0 root    root    25 Feb  8:33  nginx.http.sock
several times XD
             
            
              
            
           
          
            
              
                fefrei  
              
                  
                    February 25, 2018,  1:47pm
                   
                  8 
               
             
            
              Hm, in that case, I’m currently out of ideas. That looks fine, but obviously Nginx is having trouble connecting to it… 
             
            
              2 Likes 
            
            
           
          
            
              
                notriddle  
              
                  
                    February 25, 2018,  6:14pm
                   
                  9 
               
             
            
              Are you running with SELinux or AppArmor on the host system?
             
            
              4 Likes 
            
            
           
          
            
              
                notriddle  
              
                  
                    February 25, 2018,  7:31pm
                   
                  11 
               
             
            
              Try turning it off, then.
             
            
              3 Likes 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 25, 2018,  8:14pm
                   
                  12 
               
             
            
              Cool. That solved my issue. Only thing left is to figure out why nginx wont redirect 502 errors now
             
            
              
            
           
          
            
              
                fefrei  
              
                  
                    February 26, 2018,  8:00am
                   
                  13 
               
             
            
              Wohoo! Thanks, @notriddle !
The rest should be easy. You’re missing this bit of configuration:
location /errorpages/ {
    alias /var/www/errorpages/;
}
Without it, Nginx cannot find the error page it should serve 
             
            
              2 Likes 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 26, 2018,  8:05am
                   
                  14 
               
             
            
              i added the line but it does not seem to work
https://paste.fedoraproject.org/paste/DS781CCQ7vCuDMgT2ZD19Q 
i did restart nginx to apply the change
             
            
              
            
           
          
            
              
                fefrei  
              
                  
                    February 26, 2018,  8:22am
                   
                  15 
               
             
            
              Your error_page directive also differs from the one in my instructions, you’ll need to correct that.
However, I also get a 403 when browsing https://forum.cubedcorps.net/errorpages/discourse_offline.html , so there must be some additional problem. Having a look at the Nginx log files might help you here 
             
            
              1 Like 
            
            
           
          
            
              
                dje4321  
              
                  
                    February 26, 2018,  8:48am
                   
                  16 
               
             
            
              
Selinux was just being a pain still XD
Thanks for all your help 
             
            
              1 Like 
            
            
           
          
            
            
              This topic was automatically closed after 2295 days. New replies are no longer allowed.