0

I am using Windows Server 2008 as my server and I have installed cygwin on it.

I have installed nginx on cygwin and it is working fine.
I am running 2 projects on this server and each one has its own set of services (or in nowaday's terms microservices) which they need to talk to each other.
I want to have one nginx per each project and one main router nginx which routes the main traffic.

How can I have multiple nginx apps without using docker on this windows machine?

The nginx installation uses /etc/nginx folder for its configuration, If I install a new nginx (theoretically) then it would use the same folder so the configs get coflicted! I want to prevent this.

Is there any way to have standalone installations of nginx on windows server (under cygwin)?

Think of it as like this:

enter image description here

1 Answers1

2

https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/ You can use the existing nginx installation, and just point it to a different configuration file when starting it. Use the -c command line switch to do so.

Be aware that you have to configure nginx processes to use different ports for listening.

hargut
  • 3,908
  • 7
  • 10
  • yeah yeah , for different ports I just change the `listen` and `server_name` items in server blocks. Is it correct? – Amir Hossein Baghernezad Aug 25 '18 at 13:24
  • `listen` should be enough. You could even use the same `server_name`. Depending on your network setup, it could be even possible to use the same port, but on different ip's. – hargut Aug 25 '18 at 21:28
  • I tested it. it is not possible. For example two different config files one using 127.0.0.10 and another using 127.0.0.20 (`server_name`) and both using port 80 (`listen`) does not work and says `emerge port is already in use 0.0.0.0:80` – Amir Hossein Baghernezad Aug 26 '18 at 03:43
  • This is a wrong approach, since the `server_name` is not related to the ip/port nginx is listening on. The `server_name` relates in http connections to the `Host` header, which is sent by the client. You need to include the ip on the `listen` directive. http://nginx.org/en/docs/http/ngx_http_core_module.html#listen – hargut Aug 26 '18 at 15:39