Re: Proper way to convert an apache rewrite rule

2017-06-04 Thread Aleksandar Lazic
Hi ST. ST wrote on 04.06.2017: > Hello, > I'm new to nginx and try to move an old website from apache to nginx. > While getting rid of the .htaccess file I've encountered following > rewrite rule: > > RewriteCond %{QUERY_STRING} id=([^&]*) [NC,OR] > RewriteCond %{QUERY_STRING} daily=([^&]*) [NC]

Proper way to convert an apache rewrite rule

2017-06-04 Thread ST
Hello, I'm new to nginx and try to move an old website from apache to nginx. While getting rid of the .htaccess file I've encountered following rewrite rule: RewriteCond %{QUERY_STRING} id=([^&]*) [NC,OR] RewriteCond %{QUERY_STRING} daily=([^&]*) [NC] RewriteCond %{REQUEST_URI} !mobSpecCycle [NC]

RE: "server" directive is not allowed here error

2017-06-04 Thread Reinis Rozitis
> You can do > > nginx -T > mynginx.conf > > to have it in single file This doesn't produce a valid (immediately usable) nginx configuration though, just concats/dumps out all the various configuration files referenced from the main config. p.s. maybe it would make a sense to have a command

Re: "server" directive is not allowed here error

2017-06-04 Thread Anoop Alias
You can do nginx -T > mynginx.conf to have it in single file On Sun, Jun 4, 2017 at 6:28 PM, Peter Booth wrote: > FWIWI have never understood the desire to have nginx configuration spread > across multiple files. > It just seems to invite error and make it harder to see what is going on. > > P

Re: "server" directive is not allowed here error

2017-06-04 Thread oscaretu .
Hello, Peter. In the company where I work the file nginx.conf is bigger than 1 MB. Por each virtual server, there are lots of definitions that are almost equal. If I where the one who had to decide the file structure, I problably choose to use a different file for each virtual host, so when we hav

Re: "server" directive is not allowed here error

2017-06-04 Thread Peter Booth
FWIWI have never understood the desire to have nginx configuration spread across multiple files. It just seems to invite error and make it harder to see what is going on. Perhaps if I worked for a hosting company I’d feel differently but on the sites that I have worked on, even with quite compli

RE: "server" directive is not allowed here error

2017-06-04 Thread Reinis Rozitis
> That can't be right, because before I used the multiple location directives, I > didn't have http and it worked fine. Regardless, I followed your advice and I > got > the following now: As people have already pointed you probably have something like main config nginx.conf with: http { .. inc

Re: "server" directive is not allowed here error

2017-06-04 Thread Jim Ohlstein
On Sun, 2017-06-04 at 10:28 +, Dino Edwards wrote: > > > > You can't have server {} block outside http {} ( http://nginx.org/e > > n/docs/http/ngx_http_core_module.html#server ) > > > > So it has to be: > > > > http { > > server { > >   // whatever goes here > >  } > > } > > That can't be r

Re: "server" directive is not allowed here error

2017-06-04 Thread Anoop Alias
Hi Dino, I believe you have an unbalanced curly brace somewhere causing the error. You should check this in a text editor that can highlight syntax. On Sun, Jun 4, 2017 at 3:58 PM, Dino Edwards wrote: > > > You can't have server {} block outside http {} ( > http://nginx.org/en/docs/http/ngx_

RE: "server" directive is not allowed here error

2017-06-04 Thread Dino Edwards
> You can't have server {} block outside http {} ( > http://nginx.org/en/docs/http/ngx_http_core_module.html#server ) > So it has to be: > http { > server { > // whatever goes here > } > } That can't be right, because before I used the multiple location directives, I didn't have http and

Re: Reverse proxy that forward requests to ALL upstream servers?

2017-06-04 Thread Yongtao You via nginx
I'll give it a try. Thanks!Yongtao On Sunday, June 4, 2017 3:09 PM, Zhang Chao wrote: #yiv7683529716 body {padding:1em;margin:auto;background:#fefefe;}#yiv7683529716 h1, #yiv7683529716 h2, #yiv7683529716 h3, #yiv7683529716 h4, #yiv7683529716 h5, #yiv7683529716 h6 {font-weight:bold;}#

Re: Reverse proxy that forward requests to ALL upstream servers?

2017-06-04 Thread Zhang Chao
Hi! OpenResty is recommend in this case. You can combine it with the ngx_proxy module. On 4 June 2017 at 11:44:41, Yongtao You via nginx (nginx@nginx.org) wrote: Hi, I have a rather special requirement. I need to setup a reverse proxy with multiple upstream servers, and whenever a POST reque