【Nginx】Nginx下的Yii部署
【摘要】
Url的重写
nginx的配置文件
[root@localhost protected]# vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
...
Url的重写
nginx的配置文件
[root@localhost protected]# vim /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ /(protected|framework|nbproject|themes/\w+/views|index-test\.php) {
deny all;
# for production
internal;
log_not_found off;
access_log off;
}
#error_page 404 /404.html
文章来源: coderfix.blog.csdn.net,作者:小雨青年,版权归原作者所有,如需转载,请联系作者。
原文链接:coderfix.blog.csdn.net/article/details/42423421
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)