I have read several similar questions to this one in this forum, but not exactly the same, I tried every solution in very different ways but I am not able to manage this.
I was given some data about a server. In this server, I have to install an application which is going to run in https://localhost:31070/?a=bbb
. I did that, and now, I can access from any computer to the application writing https://xxx.xxx.xxx.xxx:31070/?a=bbb
. I installed nginx on that server as the HTTP server, to make this work.
Now, I was given a domain my.domain.com. They want to type my.domain.com on the URL and go directly to the application (go to https://localhost:31070/?a=bbb
). I was working with virtualhosts in nginx, but I do not know if this is the right way to manage that.
Anyone can help me? This is my virtualhost:
server {
listen 80;
server_name my.domain.com;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://127.0.0.1:31070/;
}
}
This is stored in a file called domain in /etc/nginx/sites-available/ which is enabled, by the way. I also edited the file /etc/hosts, adding the line xxx.xxx.xxx.xxx my.domain.com
. My problem is: if I type my.domain.com on the URL, I see nothing.
EDIT I think the virtualhost is OK, but the problem could be that my.domain.com is not being recognised by remote hosts.