serve static content on static domain
zuckbin
nginx-forum at nginx.us
Fri Apr 6 13:41:59 UTC 2012
Hi,
How to serve static content on static domain cookieless.
I use ngix to serve static content then apache to dynamic content.
Want to serve on static.mydomain.com all static content: jpeg, css, js,
...
Here my actual conf:
server {
listen 80;
client_max_body_size 50M;
server_name www.mydoamin.com;
access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log info;
location / {
proxy_pass http://IP:8080/;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
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 /home/www/domain.com;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
}
Want all my static content will be delivered only with:
static.domain.com
(no duplicate content)
Thanks for your help
Bye
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,225020,225020#msg-225020
More information about the nginx
mailing list