Yii2配置Nginx偽靜態(tài)的方法
本文實例講述了Yii2配置Nginx偽靜態(tài)的方法。分享給大家供大家參考,具體如下:
主要檢查以下代碼:
location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php?$args; }
完整代碼:
server { charset utf-8; client_max_body_size 128M; listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 server_name mysite.local; root /path/to/basic/web; index index.php; access_log /path/to/basic/log/access.log; error_log /path/to/basic/log/error.log; location / { # Redirect everything that isn't a real file to index.php try_files $uri $uri/ /index.php?$args; } # uncomment to avoid processing of calls to non-existing static files by Yii #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { # try_files $uri =404; #} #error_page 404 /404.html; location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; try_files $uri =404; } location ~ /\.(ht|svn|git) { deny all; } }
更多關(guān)于Yii相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Yii框架入門及常用技巧總結(jié)》、《php優(yōu)秀開發(fā)框架總結(jié)》、《smarty模板入門基礎(chǔ)教程》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家基于Yii框架的PHP程序設(shè)計有所幫助。
相關(guān)文章
PHP解析html類庫simple_html_dom的轉(zhuǎn)碼bug
這篇文章主要介紹了PHP解析html類庫simple_html_dom的轉(zhuǎn)碼bug ,需要的朋友可以參考下2014-05-05從零開始學(xué)YII2框架(六)高級應(yīng)用程序模板
這篇文章主要介紹了YII2框架學(xué)習(xí)筆記之高級應(yīng)用程序模板,深入淺出從安裝,配置到使用方法都做了介紹,希望對大家有所幫助2014-08-08php版微信公眾平臺接口參數(shù)調(diào)試實現(xiàn)判斷用戶行為的方法
這篇文章主要介紹了php版微信公眾平臺接口參數(shù)調(diào)試實現(xiàn)判斷用戶行為的方法,可判斷出用戶訂閱、取消訂閱、發(fā)送信息等行為,涉及微信公眾平臺接口參數(shù)調(diào)試的相關(guān)操作技巧,需要的朋友可以參考下2016-09-09