有兩個項目一個是phpcms得,另外一個是yii2.0框架的,伺服器使用的是nginx,現在想將yii的這個項目作為子目錄直接拿過來然後通過http://domain.com/子目錄來訪問,但是透過配置/子目錄可以訪問index 但是頁面的資源文件如圖片、css等都無法加載,圖片鏈接為http://domain.com/子目錄/public/images/blue_icon.png 但是還是會重定向到子目錄下面的index.php 求教問題出在哪裡?
<code>server{ listen 80; server_name domain.com; root /Users/xxx/www/project; index index.php; location /{ try_files $uri $uri/ /index.php?$args; autoindex on; } location /blog{ index index.php index.html; try_files $uri $uri/ /blog/index.php?$args; autoindex on; } location ~ ^(.+\.php)(.*)$ { root /Users/xxx/www/project; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }</code>
有兩個項目一個是phpcms得,另外一個是yii2.0框架的,伺服器使用的是nginx,現在想將yii的這個項目作為子目錄直接拿過來然後通過http://domain.com/子目錄來訪問,但是透過配置/子目錄可以訪問index 但是頁面的資源文件如圖片、css等都無法加載,圖片鏈接為http://domain.com/子目錄/public/images/blue_icon.png 但是還是會重定向到子目錄下面的index.php 求教問題出在哪裡?
<code>server{ listen 80; server_name domain.com; root /Users/xxx/www/project; index index.php; location /{ try_files $uri $uri/ /index.php?$args; autoindex on; } location /blog{ index index.php index.html; try_files $uri $uri/ /blog/index.php?$args; autoindex on; } location ~ ^(.+\.php)(.*)$ { root /Users/xxx/www/project; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }</code>