VPS侦探论坛

 找回密码
 注册
查看: 9654|回复: 6

lnmp 虚拟主机 子目录blog怎么实现伪静态(解决)

[复制链接]
发表于 2010-10-23 18:52:08 | 显示全部楼层 |阅读模式

centos5.5 lnmp0.5 ./vhost 添加虚拟主机 绑定域名 www.a.com  指定目录到/home/www/a//home/www/a/ 装了dedecms  www.a.com访问 /home/www/a/blog/ 下装了wordpress  www.a.com/blog访问如何实现blog的伪静态?编辑了/usr/local/nginx/conf/vhost/www.a.com.confserver        {                listen       80;                server_name www.025buyi.com 025buyi.com *.025buyi.com;                index index.html index.htm index.php default.html default.htm default.php;                root  /home/www/www.025buyi.com;                include a.conf;                location ~ .*\.(php|php5)?$                        {                                fastcgi_pass  unix:/tmp/php-cgi.sock;                                fastcgi_index index.php;                                include fcgi.conf;                        }                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$                        {                                expires      30d;                        }                location ~ .*\.(js|css)?$                        {                                expires      12h;                        }                access_log off;        }再修改/usr/local/nginx/conf/a.conflocation /blog/ {if (-f $request_filename/index.html){                rewrite (.*) $1/index.html break;        }if (-f $request_filename/index.php){                rewrite (.*) $1/index.php;        }if (!-f $request_filename){                rewrite (.*) /index.php;        }}以上修改方式结果不成功,wordpress 下无法实现固定链接。 请高人们指点指点

[ 本帖最后由 Bigcar 于 2010-10-24 11:51 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2010-10-24 11:51:25 | 显示全部楼层


问题解决
  1. location /blog/ {
  2. if (-f $request_filename/index.html){
  3.                 rewrite (.*) $1/index.html break;
  4.         }
  5. if (-f $request_filename/index.php){
  6.                 rewrite (.*) $1/index.php;
  7.         }
  8. if (!-f $request_filename){
  9.                 rewrite (.*) /blog/index.php;
  10.         }
  11. }
复制代码



前后都得指定目录  /blog/
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2010-10-25 11:00:09 | 显示全部楼层

可以直接调用wordpress的伪静态配置文件
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-5-18 09:52:26 | 显示全部楼层



弄这个可长时间了.郁闷死了.网上说的都不对,都是胡乱加二级目录,下面的才是对的.blog 要加对地方才是.

location /blog/ {
if (-f $request_filename/index.html){
                 rewrite (.*) $1/index.html break;
         }
if (-f $request_filename/index.php){
                 rewrite (.*) $1/index.php;
         }
if (!-f $request_filename){
                 rewrite (.*) /blog/index.php;
         }
}
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-5-19 14:11:05 | 显示全部楼层

不知道 我晕了啊啊啊啊啊啊啊啊

军哥运维代购:http://shop63846532.taobao.com/

发表于 2012-3-5 01:06:24 | 显示全部楼层

楼主,我真F了你,你分个行不行啊,看的我眼都花了
发表于 2012-3-10 19:39:14 | 显示全部楼层

谢楼主,我又学了一招。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-22 13:43 , Processed in 0.026603 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表