Nginx实现伪静态化,lnmp下typecho设置conf文件,typecho安装教程
Nginx服务器无法实现伪静态化
Nginx服务器无法登录后台,出现"405, method not allowed"
无法登录后台,点击前台链接或者后台登录时出现"404, not found"
lnmp安装Typecho后无法登陆后台,提示出错
以下是本站使用的规则文件,直接放到Nginx规则目录下重启Nginx就能正常访问Typecho后台
第一步:本地新建一个规则文件,例如:devcai.com.conf
第二步:复制以下代码到devcai.com.conf文件里
server
{
#access_log off;
listen 80;
server_name *.devcai.com devcai.com;
index index.html index.htm index.php;
root /home/wwwroot/devcai.com;
include enable-php-pathinfo.conf;
location /nginx_status
{
stub_status on;
#access_log off;
}
location / {
index index.htm index.php;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$
{
expires 30d;
}
location ~ .*\.(js|css)$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
# access_log /home/wwwlogs/access.log access;
}
第三步:上传文件devcai.com.conf到 /usr/local/nginx/conf/vhost/ 目录下
第四步:重启Nginx,就能正常访问Typecho后台