nginx reverse proxy



  • Hello. guys. i have found this,:https://github.com/designcreateplay/NodeBB/wiki/Configuring-nginx-as-a-proxy-to-NodeBB,
    currently. i am on a ubuntu12.04 server , but i dont 't know which file in /etc/nginx to edit ,

    here are my Os env:
    nginx -v : nginx version: nginx/1.4.5

    nginx -V : configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.4.5/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.4.5/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.4.5/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.4.5/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.4.5/debian/modules/ngx_http_substitutions_filter_module

    nodebb config.json:

    "base_url": "http://106.187.*.*",
        "port": "4567",
        "use_port": false,
        "secret": "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",
        "relative_path": ""
    

    any comments will be appreciated. thx so much!



  • @xenofilodotcom
    --conf-path=/etc/nginx/nginx.conf
    I think this is the right file



  • it will be in your sites available folder. It should be in /etc/nginx/sites-available/website.co.uk where website.co.uk is your website domain.


  • GNU/Linux Admin

    Both are correct. You can add the new server{} block in nginx.conf, or (ideally) in a separate file in /etc/nginx/sites-available.

    If the latter, ensure that /etc/nginx/sites-enabled is parsed (not all nginx configs do this).



  • well. thx so much for all reply, the nginx .conf works for me. and i found you should put 0.0.0.0 before the port 80. so it would look like

    server {
    listen 0.0.0.0:80;

    server_name forum.example.org;
    
    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://127.0.0.1:4567/;
        proxy_redirect off;
    
        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    

    }


Log in to reply
 

Suggested Topics

| |