課程
/后端開發(fā)
/PHP
/PHP之Yii2框架搭建完整博客系統(tǒng)
老師你好,nginx服務(wù)器的話,去掉index.php?的重寫代碼怎么寫?
2017-08-17
源自:PHP之Yii2框架搭建完整博客系統(tǒng) 2-3
正在回答
#這是我的配置文件你可以試一試
server?
? ? {?
? ? ? ? listen ?80;?
? ? ? ? server_name blog.app; ? ? ? ? ? ? #綁定域名?
? ? ? ? index index.htm index.html index.php; ?#默認(rèn)文件?
? ? ? ? root /Users/guiyun/Code/blog.app/frontend/web; ? ? ? ? ? ? ?#網(wǎng)站根目錄
? ? ? ? #rewrite ^(.*)$ ?https://$host$1 permanent;?
? ? ? ? location / {
? ? ? ? ? ? ? ? # 這里使用try_files進(jìn)行url重寫,不用rewrite了。
? ? ? ? ? ? ? ? try_files $uri $uri/ /index.php?$query_string;
? ? ? ? }
? ? ? ? location ~* \.php$ {
? ? ? ? ? ? fastcgi_index ? index.php;
? ? ? ? ? ? fastcgi_pass ? ?127.0.0.1:9000;
? ? ? ? ? ? include ? ? ? ? fastcgi_params;
? ? ? ? ? ? fastcgi_param ? SCRIPT_FILENAME ? ?$document_root$fastcgi_script_name;
? ? ? ? ? ? fastcgi_param ? SCRIPT_NAME ? $fastcgi_script_name;
? ? ? ? location ~ /\.ht {
? ? ? ? ? ? ? ? deny ?all;
? ? }
qq_呆萌果果大吃貨_0 提問者
孟源運(yùn)
qq_呆萌果果大吃貨_0 提問者 回復(fù) 孟源運(yùn)
孟源運(yùn) 回復(fù) qq_呆萌果果大吃貨_0 提問者
https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/start-installation.md
舉報(bào)
Yii是PHP快速開發(fā)的最佳實(shí)踐之一,一起領(lǐng)略yii2快速開發(fā)的風(fēng)采
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2017-08-23
server?
? ? {?
? ? ? ? listen ?80;?
? ? ? ? server_name blog.app; ? ? ? ? ? ? #綁定域名?
? ? ? ? index index.htm index.html index.php; ?#默認(rèn)文件?
? ? ? ? root /Users/guiyun/Code/blog.app/frontend/web; ? ? ? ? ? ? ?#網(wǎng)站根目錄
? ? ? ? #rewrite ^(.*)$ ?https://$host$1 permanent;?
? ? ? ? location / {
? ? ? ? ? ? ? ? # 這里使用try_files進(jìn)行url重寫,不用rewrite了。
? ? ? ? ? ? ? ? try_files $uri $uri/ /index.php?$query_string;
? ? ? ? }
? ? ? ? location ~* \.php$ {
? ? ? ? ? ? fastcgi_index ? index.php;
? ? ? ? ? ? fastcgi_pass ? ?127.0.0.1:9000;
? ? ? ? ? ? include ? ? ? ? fastcgi_params;
? ? ? ? ? ? fastcgi_param ? SCRIPT_FILENAME ? ?$document_root$fastcgi_script_name;
? ? ? ? ? ? fastcgi_param ? SCRIPT_NAME ? $fastcgi_script_name;
? ? ? ? }
? ? ? ? location ~ /\.ht {
? ? ? ? ? ? ? ? deny ?all;
? ? ? ? }
? ? }
2018-01-27
https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/start-installation.md