Question
Setting conf file in nginx from ip to subdomain
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"
}
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×