nginx開啟目錄瀏覽,解決中文亂碼問題 方法如下:
server
{
listen 80;
#listen [::]:80;
server_name
gongzi.liwenhui.xin gz.liwenhui.xin;
index index.html index.htm index.php default.html default.htm default.php;
root /www/gongzi.liwenhui.xin/;
include other.conf;
#error_page 404 /404.html;
autoindex on;
#打開目錄瀏覽。
autoindex_localtime on;
#默認為off,顯示的文件時間為GMT時間。
#改為on后,顯示的文件時間為文件的服務器時間。
autoindex_exact_size off;
#默認為on,顯示出文件的確切大小,單位是bytes。
#改為off后,顯示出文件的大概大小,單位是kB或者MB或者GB。
charset utf-8,gbk;
#解決中文亂碼問題。
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/dedecms-2.liwenhui.name.log access;
}