Report this

What is the reason for this report?

Setting conf file in nginx from ip to subdomain

Posted on March 14, 2018

Hello,

information about my files directory;

/etc/nginx /etc/nginx/conf.d /opt/forum/nodebb -----> where i’ve installed my nodebb

I would like to redirect my droplet ip and port to my subdomain.

I’ve managed to do sub.mydomain.com:4567 but i don’t want to let users see specific port.

i’ve successfuly installed nginx but i am having a trouble to set things right in conf file.

I did follow this guide to install nodebb on centos. https://www.rosehosting.com/blog/how-to-install-nodebb-on-a-centos-7-vps/

while i am on putty terminal, when i type **vi /etc/nginx/conf.d/yourdomain.com.conf **command, it gives me a blank page ( sort of ) ( not new window or something ) and i am adding this line as instructed

server {
    listen       80;
    server_name  yourdomain.com; // i did change to sub.mydomain.com;
    location / {
        proxy_pass        http://localhost:4567/; // i didn't change anything here

        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_set_header X-Forwarded-Proto $scheme;

        proxy_redirect off;
        proxy_buffering   off;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

after i added these lines, i don’t know how to save while i am on putty so i am closing putty and it asks to me that " are you sure to close this session" so, i am saying “yes” and reopen putty to making further progress.

when i check the conf file i’ve created via filezilla, it is compiled so i can’t see if it is set as it should be or not.

I mean i can’t see this lines on file.

So Am i doing something wrong on putty ? Is there command or something that file i added those lines and save it while i am on putty without closing putty and see how it went ?

If it is not related with putty, how can i fix this ?

nodebb\config.json has set to;

{
    "url": "http://sub.mydomain.net",
    "secret": "secret thingy",
    "database": "redis",
    "redis": {
        "host": "127.0.0.1",
        "port": "6379",
        "password": "password",
        "database": "0"
    },
    "type": "literal"
}

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.