Server name rewrite

Hi, guys!

E.g. I have server new_server_name.com and want to rewrite requests to
www.new_server_name.com and old_server_name.com to present server.

From Pitfalls and Common Mistakes | NGINX I use two server’s {} directives for
this instead if().

server {
server_name www.new_server_name.com old_server_name.com;
return 301 $scheme://new_server_name.com$request_uri;
}

server {
listen 10.15.1.2:80;
server_name new_server_name.com;

… server staff…
}

But this doesn’t work and first server {} directive MUST have listen
directive as well.

So, or I am do something wrong or wiki-page doesn’t clear describe this
situation?


Cheers,
w

Is anyone maintaining a “current” version of nginx with mod-security
linked-in?

I realize this is a bit lazy on my part – the instructions seem
relatively straightforward to build – but I didn’t want to “re-invent
the wheel” if I didn’t have to.

Thanks,
AJ

I do a custom-build for our own servers (in private pkg-ng repository)
with a handful of useful modules included. Because the truth is: only
you know what modules you want or need.

This is absolutely true. (And I’m running CentOS and have been very
happy as well.)

Thanks.

Am 19.06.2013 um 21:04 schrieb AJ Weber [email protected]:

Is anyone maintaining a “current” version of nginx with mod-security linked-in?

I realize this is a bit lazy on my part – the instructions seem relatively
straightforward to build – but I didn’t want to “re-invent the wheel” if I didn’t
have to.

The FreeBSD port recently gained support for mod_security.

You can even build the dev-version:

FreeBSD + nginx works super-smooth.

I do a custom-build for our own servers (in private pkg-ng repository)
with a handful of useful modules included.
Because the truth is: only you know what modules you want or need.

On Wed, Jun 19, 2013 at 09:22:11PM +0300, wishmaster wrote:

Hi there,

From Pitfalls and Common Mistakes | NGINX I use two server’s {} directives for this
instead if().

But this doesn’t work and first server {} directive MUST have listen directive
as well.

http://nginx.org/en/docs/http/request_processing.html

A request comes to an ip:port. nginx chooses the set of best-match
servers
for that ip:port. A request indicates which Host: it cares about. nginx
chooses the one matching server from that set of servers.

Which means (approximately): if you want all possible server{} blocks to
be available to match a request, they should all have the same “listen”
directives.

So, or I am do something wrong or wiki-page doesn’t clear describe this
situation?

That wiki page section doesn’t any “listen” directives. I imagine the
author thought that that aspect was out of scope for that document.

f

Francis D. [email protected]

Thank you Francis, your answer is exhaustive, as always.

— Original message —
From: “Francis D.” [email protected]
Date: 20 June 2013, 00:27:48