Advertisement
grikdotnet

multiple root nginx config

Aug 10th, 2015
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.43 KB | None | 0 0
  1. server{
  2. set $RELEASE app-dev;
  3. set $PROJECT_PATH /opt/www/sdaminfo;
  4. set $yii_bootstrap index.php;
  5. set $html_root $PROJECT_PATH/wwwroot;
  6.  
  7.     listen 80;
  8.  
  9.     include conf.d/application_params;
  10. root $html_root;
  11.  
  12. location / {
  13.     include       conf.d/sdaminfo_fastcgi_params;
  14.     fastcgi_param SCRIPT_FILENAME $PROJECT_PATH/$RELEASE/php_htdocs/$yii_bootstrap;
  15.     fastcgi_param SCRIPT_NAME /$yii_bootstrap;
  16. }
  17.  
  18. location ~ \.php$ {
  19.     fastcgi_split_path_info  ^(.+\.php)(.*)$;
  20.  
  21.     # let yii catch requests to non-existing php files
  22.     set $fsn $PROJECT_PATH/$RELEASE/php_htdocs/$yii_bootstrap;
  23.     if (-f $PROJECT_PATH/$RELEASE/php_htdocs$fastcgi_script_name){
  24.         root  $PROJECT_PATH/$RELEASE/php_htdocs;
  25.         set $fsn $PROJECT_PATH/$RELEASE/php_htdocs$fastcgi_script_name;
  26.     }
  27.  
  28.     include       conf.d/sdaminfo_fastcgi_params;
  29.     fastcgi_param SCRIPT_FILENAME   $fsn;
  30.     fastcgi_param SCRIPT_NAME       $fastcgi_script_name;
  31.     fastcgi_param PATH_TRANSLATED   $fsn;
  32. }
  33.  
  34. location ~ ^/(images|js|css)/ {
  35.     expires  90d;
  36.     root $PROJECT_PATH/$RELEASE/static_htdocs;
  37. }
  38.  
  39. location ~ ^/(assets|files) {
  40.     root $html_root;
  41. }
  42.  
  43. location /fancybox/ {
  44.     root $PROJECT_PATH/$RELEASE/static_htdocs/js;
  45. }
  46.  
  47.     location = /sitemap.xml {
  48.         alias $html_root/sdaminfo.sitemap.xml;
  49.     }
  50.  
  51.     location = /robots.txt {
  52.         alias $PROJECT_PATH/$RELEASE/static_htdocs/robots/sdaminfo.robots.txt;
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement