plainblack.com
Username Password
search
Bookmark and Share

    

Nginx Config for WebGUI 7.10

User pvanthony
Date 9/18/2012 3:54 am
Views 15562
Rating 9    Rate [
|
]
Previous · Next
User Message
pvanthony

Going to try and replace apache modproxy with nginx for WebGUI 7.10.

I am doing this so that I can prepare for WebGUI 8.

Has anyone done this before? If yes, please share the nginx config for the vhost.

P.V.Anthony



Back to Top
Rate [
|
]
 
 
bartjol

We have a config according to the attached file. Not sure whether it is optimized, but it works for us.

replaced the file, because there was 1 line that was turning of logging for the loadbancing, which isn't needed in standard environment



Attached Files
Back to Top
Rate [
|
]
 
 
pvanthony

We have a config according to the attached file. Not sure whether it is optimized, but it works for us.

replaced the file, because there was 1 line that was turning of logging for the loadbancing, which isn't needed in standard environment

Thank you for sharing the config file.

I will try and report back.

P.V.Anthony



Back to Top
Rate [
|
]
 
 
bartjol

You might want to set the client_max_body_size for the server section in the nginx.conf to another value, depending on what size of documents should be allowed to upload



Back to Top
Rate [
|
]
 
 
pvanthony

Just wanted to report back that the config for nginx is working great.

Just to add, I am using ispconfig to manage the sites. The config works well with ispconfig web interface.

Once again thank you for sharing the nginx config.

P.V.Anthony



Back to Top
Rate [
|
]
 
 
pvanthony

Just noticed files with restricted permissions set in webgui are still being served.

The apache modperl is working correctly and stops the file from being served. The nginx does not seem to be following the rules set in the config.

I am guessing the line with .wgaccess is the issue. Does anyone have a solution for this? The nginx used is 1.4.2.

Here is the config that I think is the problem.

location /uploads {
		expires 2h;
		if ( $request_filename ~ "^(.*/)" ) {
			set $request_directory $document_root$1;
		}
		if ( -f "$request_directory/.wgaccess" ) {
			proxy_pass http://127.0.0.1:8081;
		}
	}



Back to Top
Rate [
|
]
 
 
arjan

Hi,

Anyone found a solution for this already?

Kind regards,

Arjan Widlak

United Knowledge
Internet for the public sector

www.unitedknowledge.nl



Back to Top
Rate [
|
]
 
 
roryzweistra

To my understanding, nginx doesn't really like if statements. I did not test this, but I believe it should be something like:

try_files $request_directory/.wgaccess @proxy;   location @proxy {     proxy_pass http://127.0.0.1:8081; }

---------------------------------------------------------------

Rory Zweistra

rory@ryuu.nl

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan



Back to Top
Rate [
|
]
 
 
arjan

Hi Rory!

Long time.

It seems that the use of $request_directory is part of the problem. That is a variable that can be set, as in the second statement, but is not by default the uri without the file name. Or am I mistaken here? Anyway, without a 'set' directive first, nginx does not recognize the 'request_directory' variable.

In the solution you give here, it would return the .wgaccess file, would it not? As I understood, try_files not only tries if the options are available in the given order, but also returns them.

BTW. I was hoping that in one of PB's git repositories an example could be found. But in the nginx.template of wrebuild, every static file is returned via the upstream proxy(!).

https://github.com/plainblack/wrebuild/blob/master/wre/var/setupfiles/nginx.template

Kind regards,

Arjan Widlak

United Knowledge
Internet for the public sector

www.unitedknowledge.nl



Back to Top
Rate [
|
]
 
 
    



© 2019 Plain Black Corporation | All Rights Reserved