nginx halp plskthx [solved]

General Discussion
  • I guess i forgot how to set up nginx. What am I forgetting to do?

    I've installed nginx, got it to say 'welcome to nginx' through my domain url and IP address, added and aliased this file to sites-enabled/available:

    server {
    listen 80;
    
    server_name bikenode.com;
    
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    
        proxy_pass http://178.62.247.86:4567/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
       }
    }
    

    Reloaded nginx. Now i don't even get the 'Welcome to nginx' page. I just get 'Safari can't connect to the server.' Im forgetting something. Nginx is 1.6.x. ... I'm searching for an answer now but if someone has it before i can find it, awesome.

  • Check config.json in NodeBB folder for use port set as false and that the port is correct. Make sure you didn't type 4657 or anything like that.

    The symlink should be from sites-available to sites-enabled, not sure if this causes an issue if the other way around.

    Could also try removing the end forward slash from your proxy pass url, I'm on my iPad so can't cross reference mine with yours at the minute.

    Also nice theme. Might need to adjust the template as it mentions @trevor's site in the sidebar.

  • -config.json:

    {
    "base_url": "http://bikenode.com",
    "port": "4567",
    "secret": "******-*****-*****-*****-*********",
    "bind_address": "0.0.0.0",
    "database": "redis",
    "redis": {
        "host": "127.0.0.1",
        "port": "6379",
        "password": "",
        "database": "0"
    },
    "bcrypt_rounds": 12,
    "upload_path": "/public/uploads",
    "use_port": false,
    "relative_path": ""
    }
    

    -Symlink goes from -available to -enabled

    -The '/' in the line 'location / {' was part of what I copied and pasted, but I deleted it and tested it to see if it made a difference, and it didn't. Reverted it back.

    -Thanks for catching a convoe reference. I plan on changing it all up after it's stable and running. Until then I want to at least make it not say convoe everywhere. 😉

    Thanks for the guesses. Hopefully I'll figure this out and get back to messing with the theme.

  • PORT     STATE SERVICE
    22/tcp   open  ssh
    4567/tcp open  tram
    

    1st reason could be your nginx is not running at all.
    But you mentioned you restarted so I guess the 2nd possibility.

    /etc/init.d/nginx start
    

    your firewall is blocking port 80

  • @termnml said:

    your firewall is blocking port 80

    nginx is definitely running. It's routing http://BikeNode.com to the same broken page as http://178.62.247.86/ . How do I check to see if my firewall is blocking 80?

  • @kevin
    That your domain is resolved to your IP adress is not the work of nginx. That does the DNS service for you.
    The Check depends on your server. If you manage it all your own eg root-server. Check: iptables -L -n
    If the output is very long simply do a iptables -L -n | grep :80

    If your firewall is set by any software/interface of your provider, you have to look there.

  • @termnml
    ah you're right about dns. I don't think there is a firewall. I'm just using digitalocean. If i run iptables -L -n i get:

    Chain INPUT (policy ACCEPT)`
    target     prot opt source               destination
    
    Chain FORWARD (policy ACCEPT)`
    target     prot opt source               destination         
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
  • When you run sudo service nginx reload, what do you get? Does it say fail? Or ok?

    What's the output of nginx -t

  • @a_5mith

    [email protected]$#!%:~/nodebb# service nginx reload
    * Reloading nginx configuration nginx                                   [ OK ] 
    [email protected]$#!%:~/nodebb# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    
  • try changing proxy_pass http://178.62.247.86:4567/; to proxy_pass http:127.0.0.1:4567/;

  • Ran the following:

    [email protected]$#!%:~# cd /etc/nginx/sites-available
    [email protected]$#!%:/etc/nginx/sites-available# sudo nano bikenode.com
    
    
    
      GNU nano 2.2.6             File: bikenode.com                                 
    
    server {
        listen       80;
        server_name  bikenode.com;
        location / {
            proxy_pass        http:127.0.0.1:4567/;
    
            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_redirect off;
           proxy_buffering   off;
    
          proxy_http_version 1.1;
           proxy_set_header Upgrade $http_upgrade;
           proxy_set_header Connection "upgrade"
        }
    }
    
    [email protected]$#!%:/etc/nginx/sites-available# service nginx restart
    * Restarting nginx nginx                                                [ OK ] 
    

    @Scuzz, Doesn't appear to have made a difference. Cleared browser cache but let me know if it's working for anyone else.

  • I dont think it has anything to do with the configs.
    Otherwise nginx would complaining.
    I'm curious that your port 80 isn't visible to the outside at all.

    Which system is running?
    Debian, Ubuntu, CentOS?

  • @termnml latest ubuntu. If anyone's interested in peeking around i can send them a userid/pw.

  • This sir is never a good idee 😉
    For such configs is always root needed.
    And don't give this access to "some guys" on the internet. 😉

    Latest Ubuntu? On a server? For production? O.o arg

  • Could it be that you started with a LAMP setup and wanted to switch to nginx (because it is so awesome :D)?

  • I dont believe so. Im terrible with this stuff and was following the nodebb for dummies installation.

  • @kevin said:

    I dont believe so. Im terrible with this stuff and was following the nodebb for dummies installation.

    Was Apache installed on your system or nginx already?

  • I don't think so. just node-v0.10.33 on ubuntu 14.04.
    in the meantime i'll start a new droplet and see if I can't get it to work on that.

  • Could you paste logs for nginx (pastebin)?
    pastebin: option Paste Exposure: Unlisted

    Try to reach your normal domain and then do:

    tail /var/log/nginx/error.log 
    tail /var/log/nginx/access.log
    


Suggested Topics


| | | |