Created
April 13, 2016 16:01
-
-
Save 52cik/8bc570cd9a9874269be03a0a594afd42 to your computer and use it in GitHub Desktop.
nginx yii2 通用配置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen 80; | |
charset utf-8; | |
index index.html index.php; | |
error_page 404 /404.html; | |
# 开启 php 并支持 pathinfo | |
include enable-php-pathinfo.conf; | |
# yii2 rewrite | |
location / { | |
try_files $uri $uri/ /index.php?$args; | |
} | |
# 静态资源缓存 30天 | |
location ~ .*\.(js|css|gif|jpg|jpeg|png|bmp|swf)$ { | |
expires 30d; | |
} | |
# 禁止访问 . 开头的文件 | |
location ~ /\. { | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment