phalcon框架的nginx配置

這是一個在Ubuntu下安裝lnmp中的配置。php

問題

當咱們須要引入js的時候,發現js和css,圖片引不進來等,css

這裏在確保代碼徹底正確的狀況下,還要配置nginx的配置文件。html

直接上代碼吧!nginx

server {
       listen 80;
       listen [::]:80;
       server_name phalcon.dev;
        set $root_path '/var/www/html/public';
       root /var/www/html;
       index index.php index.html;
       location ~ \.php$ {

              include snippets/fastcgi-php.conf;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
              include fastcgi_params;
        }
         location /{
                  rewrite ^$ public/ last;
                  rewrite ^(.*)$  /public/index.php?_url=$1 last;

        }

        location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
                root $root_path;
         }

         location ~ /\.ht {
                deny all;
        }

}
相關文章
相關標籤/搜索