|
|||
|
Vhosts
Im looking to run nginx infront of apache to serve static content. I did some research on this with lighttpd a while back, if i remember right, the only problem is virtual hosts.
I can see two ways of getting this to work with cpanel; either modify the vhost creation function, to mirror them into nginx's config or to have a cron or something that enumerates all of the ( or the latest ) vhosts added by cpanel, and updates the nginx config accordingly. now, in nginx the vhost exsample is like so; Code:
http {
server {
listen 80;
server_name www.domain1.com;
access_log logs/domain1.access.log main;
location / {
index index.html;
root /var/www/domain1.com/htdocs;
}
}
server {
listen 80;
server_name www.domain2.com;
access_log logs/domain2.access.log main;
location / {
index index.html;
root /var/www/domain2.com/htdocs;
}
}
}
Code:
server {
listen 80;
server_name some-server.com www.server-name.com;
access_log logs/host.access.log main;
# Main location
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
# Static files location
location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
root /spool/www/members_ng;
}
}
And what would be the best way to go about setting this one up? Edit: probably posted in the wrong forum, haha Last edited by dtredwell; 06-03-2007 at 09:10 AM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|