1. server {
  2. listen 80;
  3. server_name www.domain.com domain.com;
  4. root /var/www/domains/domain.com/html;
  5.  
  6. if ($http_host != "www.domain.com") {
  7. rewrite ^ http://www.domain.com$request_uri permanent;
  8. }
  9.  
  10. access_log /var/log/nginx/domains/domain.com-access.log main;
  11. error_log /var/log/nginx/domains/domain.com-error.log;
  12.  
  13. index index.php index.html;
  14.  
  15. location ~ /\. { deny all; log_not_found off; access_log off; }
  16. location = /favicon.ico { log_not_found off; access_log off; }
  17. location = /robots.txt { allow all; log_not_found off; access_log off; }
  18.  
  19. rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
  20.  
  21. rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
  22. rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
  23. rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
  24. rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
  25. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
  26. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
  27. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
  28. rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
  29. rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
  30. rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
  31. rewrite ^/sitemap.xml$ /sitemap-11.xml last;
  32.  
  33. try_files $uri $uri/ /index.php$is_args$args;
  34.  
  35. error_page 404 /index.php?controller=404;
  36.  
  37. location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
  38. expires 365d;
  39. log_not_found off;
  40. access_log off;
  41. }
  42.  
  43. location ~ \.php$ {
  44. fastcgi_buffers 8 16k;
  45. fastcgi_buffer_size 32k;
  46. try_files $uri =404;
  47. include fastcgi_params;
  48. fastcgi_pass unix:/var/lib/php-fpm/www.sock;
  49. fastcgi_index index.php;
  50. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  51. fastcgi_param PHP_ADMIN_VALUE "sendmail_path=/usr/sbin/sendmail -t -i -f www@domain.com";
  52. fastcgi_intercept_errors on;
  53. }
  54. }