全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 7499|回复: 69
打印 上一主题 下一主题

nginx下的wordpress固定连接

[复制链接]
跳转到指定楼层
1#
发表于 2009-11-1 11:05:29 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
这个是主机配置文件

server
{
  listen       80;
  server_name www.abc.com;
  index index.html index.htm index.php;
  root  /web/www/abc;
  location ~ .*\.(php|php5)?$
   {
    fastcgi_pass  unix:/tmp/php-cgi.sock;
    #fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    include fcgi.conf;
   }
  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
    expires      30d;
   }
  location ~ .*\.(js|css)?$
   {
    expires      12h;
   }
  access_log   off;
}


www.adc.com是域名,在abc.com/blog下有个博客是wordpress的,
找到的wordpress在nginx下的规则是


location / {
        index index.html index.htm index.php;
        root /home/www/abc/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;
        }
}


红体字那部分写的对吗?
70#
发表于 2010-1-26 21:20:36 | 只看该作者

回复 69# 的帖子

嘿嘿,学习了。
69#
发表于 2010-1-26 21:04:31 | 只看该作者

回复 67# 的帖子

恩,确认可以的,可以看这里
http://www.lixing.org/wp-demo/google/

wp-demo是wp的子目录,google是/%postname%/
68#
发表于 2010-1-26 20:17:54 | 只看该作者
nginx还真有点麻烦
67#
发表于 2010-1-26 20:14:39 | 只看该作者

回复 66# 的帖子

确认这样可以么? 原来子目录这么弄。
66#
发表于 2010-1-26 17:55:50 | 只看该作者
这么久了,不知道楼主弄出来没有

我试过,这样是没问题的, 假设你的子目录是blog,

location /blog/ {
                if (!-e $request_filename) {
                        rewrite ^(.*)$ /blog/index.php?q=$1 last;
                }
}

65#
发表于 2009-11-2 13:13:25 | 只看该作者
原帖由 qwe123 于 2009-11-2 12:31 发表
你们在干嘛呢


在讨论nginx环境下,子目录安装WordPress怎么伪静态。
64#
发表于 2009-11-2 12:40:30 | 只看该作者
忘了关键性问题,你在后台设置了没有?固定链接那里,截个图出来,再把你的WP地址发出来。
63#
发表于 2009-11-2 12:31:45 | 只看该作者
你们在干嘛呢
62#
 楼主| 发表于 2009-11-1 23:19:57 | 只看该作者

回复 61# 的帖子

这样还是不行。啊。


server
        {
                listen       80;
                server_name 我的域名;
                index index.html index.htm index.php;
                root  /home/www/我的目录;

                #limit_conn   crawler  20;

                #location /status {
                #stub_status    on;
                #access_log     off;
                #}

                if (!-e $request_filename) {
                        rewrite ^(.*)$ /blog/index.php?q=$1 last;
                }

                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                #fastcgi_pass  127.0.0.1:9000;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }

                log_format  access1  '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log  /web/logs/access.log  access;
        }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-11-12 04:12 , Processed in 0.069649 second(s), 11 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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