Sites overlap in a EC2 server

Hi,

I have an elatic virtual private server (EC2 VPS by Amazon), in which I
would like to host two website (ndrini.eu and dradambrosio.eu).

The first (ndrini.eu) is a django dinamic website,
and the second (dradambrosio.eu) is only a static file (to be simpler as
possible).

If only ndrini.eu is enabled, the ndrini.eu site works all right,
but if I enable also dradambrosio.eu, the first also stops to work.

These are my settings:

ndrini.eu

server {
listen 80;
server_name *.ndrini.eu;

location /static {
    alias /home/ndrini/sites/superlists-staging.ndrini.eu/static;
}

location / {
    proxy_pass http://localhost:8000;
}

}

============================================

dradambrosio.eu

server {
listen 80;
server_name *.dradambrosio.eu;
location / {
root /home/ndrini/sites/loomio;
index home.html;
}
}

Can someone tell me why and how to fix it?

Thanks,

Andrea

Posted at Nginx Forum:

Looks good, although you did not provide the whole configuration file
(or
chain if there are some include directives).

You can test your configuration with nginx -t.
On reload command, check the error logfile for errors.

How do you ‘enable’ or ‘disable’ a domain?
What tests are you doing? What results did you expect? What results did
you
get?

B. R.

On Sun, Mar 20, 2016 at 09:07:58AM -0400, ndrini wrote:

Hi there,

server_name *.ndrini.eu;

http://nginx.org/r/server_name

This sever_name will match www.ndrini.eu. but will not match ndrini.eu.

dradambrosio.eu

server {
listen 80;
server_name *.dradambrosio.eu;

And this one will match www.dradambrosio.eu but will not match
dradambrosio.eu.

If you make a request for a server_name which does not match, then the
default server for the appropriate ip:port is chosen.

Can someone tell me why and how to fix it?

My guess is that you are testing with a request for a url like
http://dradambrosio.eu/, which you do not explicitly configure for.

In that case, remove the “*”.

f

Francis D. [email protected]

Thanks,
I’ll try it!!

Andrea

Posted at Nginx Forum: