PDA

View Full Version : Modify / include nginx config


Helmi
11-02-2009, 10:58 PM
hi,

I'd like to add some stuff to nginx config special for one ore more vhosts.

I'm using nginx with the default isp manager setup as a proxy.

Is that possible? Where can i add my own stuff without it beeing removed by isp manager later?

Thanks for helping.

Frank

slava
11-03-2009, 07:19 AM
ISPmanager can work with nginx. It uses nginx as front-end before apache. What system do you have? Nginx can be installed via Features menu.

Helmi
11-03-2009, 07:24 AM
I am alreay using nginx as a frontend proxy but i'd like to add some own config code to nginx config (or via include).

Is this possible without isp manager having overwrite it?

The reason is i'd like to add some rules to fetch special static files from a worpdress+wp-supercache setup. These files are not directly called but have to be found via rules.

The have to be added at vhost level - an include would be fine.

slava
11-03-2009, 08:21 AM
Yes, you can add lines to nginx config and this include will not be overwritten

Helmi
11-03-2009, 08:27 AM
so i can just add a line within the server part of a vhost? for example here:


server {
listen 109.123.66.120:80;
server_name domain.com;

here

location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
proxy_pass http://0.0.0.0:8080;
proxy_redirect http://domain.com:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://0.0.0.0:8080;
proxy_redirect http://domain.com:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|av i|zip|gz|bz2?|rar)$ {
root /var/www/.../data/www/...;
access_log /var/www/httpd-logs/community.heimtechnik.com.access.log;
error_page 404 = @fallback;
}
location @fallback {
proxy_pass http://0.0.0.0:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}


or is there a way to place an include file in the conf.d directory and override parts in the server-part of the config?

slava
11-03-2009, 09:20 AM
Add lines where you type "here"

krisj
05-21-2011, 01:05 AM
what do I do to change the nginx.conf template ispmanager uses?

I have to add expire setting into the server locations.

e.g. I have to change the default ispmanager:
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|av i|zip|gz|bz2?|rar)$ {
root /var/www/user/data/www/test.domain.com;
access_log /var/www/httpd-logs/test.domain.com.access.log ;
access_log /var/www/nginx-logs/user isp;
}

to this:

location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css)$ {
root /var/www/user/data/www/test.domain.com;
access_log off;
expires 30d;
}


i would like this to be used as a default on my server, is it possible? or do I have to make my own manual script?

steven99
07-26-2012, 12:36 AM
Did you ever get this figured out? I'm at the same point now as you were.

slava
07-31-2012, 12:23 PM
No, this is did not possible