Advertisement
oxx93

Untitled

Aug 12th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. # include common/upstream;
  2.  
  3. server {
  4. # Порты
  5. listen 80;
  6.  
  7. root /var/www/yii.local;
  8. index index.php index.html index.htm;
  9. server_name yii.local;
  10.  
  11. location ~ \.php$ {
  12. try_files $uri =404;
  13. include common/php-fpm;
  14. }
  15. }
  16.  
  17. server {
  18. set $host_path "/www/yii.local"; # !!!!тут поменял!!!
  19. access_log /www/mysite/log/access.log main; #тут походу тоже надо менять
  20.  
  21. server_name yii.local; # !!!!тут поменял!!!
  22. root /var/www/yii.local; # !!!!тут поменял!!!
  23. set $yii_bootstrap "index.php";
  24.  
  25. charset utf-8;
  26.  
  27. location / {
  28. index index.html $yii_bootstrap;
  29. try_files $uri $uri/ /$yii_bootstrap?$args;
  30. }
  31.  
  32. location ~ ^/(protected|framework|themes/\w+/views) {
  33. deny all;
  34. }
  35.  
  36. # отключаем обработку запросов фреймворком к несуществующим статичным файлам
  37. location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
  38. try_files $uri =404;
  39. }
  40.  
  41. # передаем PHP-скрипт серверу FastCGI, прослушивающему адрес 127.0.0.1:9000
  42. location ~ \.php {
  43. fastcgi_split_path_info ^(.+\.php)(.*)$;
  44.  
  45. # позволяем yii перехватывать запросы к несуществующим PHP-файлам
  46. set $fsn /$yii_bootstrap;
  47. if (-f $document_root$fastcgi_script_name){
  48. set $fsn $fastcgi_script_name;
  49. }
  50.  
  51. fastcgi_pass 127.0.0.1:9000;
  52. include fastcgi_params;
  53. fastcgi_param SCRIPT_FILENAME $document_root$fsn;
  54.  
  55. # PATH_INFO и PATH_TRANSLATED могут быть опущены, но стандарт RFC 3875 определяет для CGI
  56. fastcgi_param PATH_INFO $fastcgi_path_info;
  57. fastcgi_param PATH_TRANSLATED $document_root$fsn;
  58. }
  59.  
  60. # не позволять nginx отдавать файлы, начинающиеся с точки (.htaccess, .svn, .git и прочие)
  61. location ~ /\. {
  62. deny all;
  63. access_log off;
  64. log_not_found off;
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement