20.1 wordpress没有实现伪静态时的网页:
20.2进入wordpress后台:
1、设置
2、固定链接
3、自定义链接
/archives/%post_id%.html #%post_id%是数据库对应博文内容对应唯一的id,例如122;
20.3 修改nginx配置文件:
[root@web01 extra]# pwd
/application/nginx/conf/extra
[root@web01 extra]# vim php.conf
server {
listen 172.16.1.8:80;
server_name www.php.com;
location / {
root html/php/;
index index.php index.html;
if (-f $request_filename/index.php){#如果请求的网页存在index.php则跳转到index.php;
rewrite (.*) $1/index.php;
}
if (-f $request_filename/index.html){#如果请求的网页存在index.html存在则跳转到index.html;
rewrite (.*) $1/index.html;
}
if (!-f $request_filename){#如果请求的网页不存在则跳转到index.php;
rewrite (.*) /index.php;
}
#说明,上面的配置是由程序内部实现的,不必深究;
}
location ~ .*\.(php|php5)?$ {
root html/php/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
[root@web01 nginx]# sbin/nginx -t
nginx: the configuration file /application/nginx-1.8.1/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.8.1/conf/nginx.conf test is successful
[root@web01 nginx]# sbin/nginx -s reload
20.1 访问测试:
网页变成了伪静态页面;