Nginx setup problem on 1st IP had multiple domain names?

Asked by paul juniper

How to configure nginx so that there are several sites on the 1st IP

Google has a lot of information on how to configure apache, and there is nothing on nginx, including on the official website.

I would be glad of any useful information, ideally, of course, would be a config.

Wait there are 2 IP on which on 1 site. The second IP was bought purely for the test. I’m trying to do everything on different IPs on 1st IP.

Part of the current config:

server {

 listen 89.248.105.84:80;

 server_name termoteks.ru www.termoteks.ru;

root /var/www/vhosts/termoteks.ru/public;

 passenger_enabled on;

 }

server {

 listen 89.248.105.87:80;

 server_name eugene-studio.ru www.eugene-studio.ru;

location / {

 root /var/www/vhosts/eugene-studio.ru/public;

 index index.html index.htm;

 }

ZY as it is clear from the part of the config, everything is spinning on REE and passenger

ZYY.Y. completely forgot, I only have nginx and no apache

Answers

vineeth
works for me like this

server {
 listen X.X.X.X: 80;
 server_name cdn.XXXX.ru;
...
 }

server {
 listen X.X.X.X: 80;
 server_name cdn.gdeposylka.ru l.gdeposylka.ru;
...
 }

in the listen directive, the IP should be the same in both servers
Replies:
That's it.
Actually, you can not write at all.
In addition, it is convenient to create a separate config for each virtual host, store them in / etc / nginx / sites-aviable, and symlink to the / etc / nginx / sites-enabled folder those that should be currently enabled. These folders in the same debain are enabled by default. - natalie rasell
& gt; listen you can not write at all.

It is better to write, I have two IP on the interface. on one, the Apache is listening, and on the second, ngnix. There are a few more IPs that hang on lo, there are various applications on each IP, and ngnix proxies requests to them. - jessica katz
Multiple loopback interfaces with different IPs?
Sounds interesting ...
And why is this needed, what 127.0.0.1 does not suit you with? - rebekah degener
Each application has its own application on each IP, you can only use 127.0.0.1 and send it to ports, or you can load a bunch of IP on a loopback and post applications on IP. I prefer the second option - gina beirne
jeska
. You just need to listen 80, without ip.
Shaping in Linux (vlan + nat + in / out)? :: New project from the creator of Habr :: Call asterisk and play mp3? :: Google Accounts :: VOIP GSM gateway from 3G modem, who has experience?
Leave Repply for Nginx setup problem on 1st IP had multiple domain names?
Useful Links