Bigcar 发表于 2010-10-22 22:13:06

lnmp0.5 伪静态设置,走过路过进来帮帮忙

linode VPSCentos 5.0 LNMP0.5

WWWROOT主目录安装的DEDECMS
WWWROOT/BLOG 子目录安装的wordpress

想请问下dedecms 和 wordpress 的伪静态分别怎么设置?

是修改nginx.conf 添加include wordpress.conf吗?

licess 发表于 2010-10-23 09:37:02

回复 1# 的帖子

修改wordpress.conf 将里面的location /   改成location /blog/
,再include到server里面既可以。
dede的直接include 上dede的伪静态就行。

Bigcar 发表于 2010-10-23 13:27:56

为了避免其他的虚拟主机发生冲突 ,按照军哥的提示,
我将wordpress.confcp了一份,并修改名为025buyiwordpress.conf,修改其中的location /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 (.*) /index.php;
      }
}


然后在nginx.conf 加入 include 025buyiwordpress.conf


userwww www;

worker_processes 1;

error_log/home/wwwlogs/nginx_error.logcrit;

pid      /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
        {
                use epoll;
                worker_connections 51200;
        }

http
        {
                include       mime.types;
                default_typeapplication/octet-stream;

                server_names_hash_bucket_size 128;
                client_header_buffer_size 32k;
                large_client_header_buffers 4 32k;
                client_max_body_size 8m;

                sendfile on;
                tcp_nopush   on;

                keepalive_timeout 60;

                tcp_nodelay on;

                fastcgi_connect_timeout 300;
                fastcgi_send_timeout 300;
                fastcgi_read_timeout 300;
                fastcgi_buffer_size 64k;
                fastcgi_buffers 4 64k;
                fastcgi_busy_buffers_size 128k;
                fastcgi_temp_file_write_size 256k;

                gzip on;
                gzip_min_length1k;
                gzip_buffers   4 16k;
                gzip_http_version 1.0;
                gzip_comp_level 2;
                gzip_types       text/plain application/x-javascript text/css application/xml;
                gzip_vary on;

                #limit_zonecrawler$binary_remote_addr10m;

server
        {
                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/wwwroot/www.025buyi.com;

                include 025buyiwordpress.conf;include dedecms.conf                location ~ .*\.(php|php5)?$
                        {
                                fastcgi_passunix:/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;
        }

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

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

                log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log/home/wwwlogs/access.logaccess;
        }
include vhost/*.conf;
}


lnmp restart 后

进wordpress后台,http://www.025buyi.com/blog/wp-admin

设置自定义固定链接为 /%post_id%.html

显示更新成功,发布新文章,出现404

将固定链接结构修改为默认,重新发布文章就能成功!


请问军哥,偶哪里做错了?

licess 发表于 2010-10-23 13:40:32

回复 3# 的帖子

重启过nginx没?/usr/local/nginx/sbin/nginx -t 测试看有错误没?
/root/lnmp restart 重启。

Bigcar 发表于 2010-10-23 13:42:53

另外 我检查了 /blog/下的 .htaccess   0字节   wordpress后台固定链接自定义虽然显示更新成功 ,但是.htaccess 却是零字节,打开后也没有内容。。。。。

licess 发表于 2010-10-23 13:55:41

回复 5# 的帖子

.htaccess 对nginx不起作用

Bigcar 发表于 2010-10-23 14:22:34

# /usr/local/nginx/sbin/nginx -t
: "location" directive is not allowed here in /usr/local/nginx/conf/nginx                                       .conf:82
configuration file /usr/local/nginx/conf/nginx.conf test failed

82行出错?

lovegx999 发表于 2010-10-27 10:53:10

请教 这个冷碟的伪静态 怎么改成 nginx的伪静态

RewriteEngine on
RewriteRule^book/(+)\.html$book\.php\?id=$1
RewriteRule^class/(+)/(+)\.html$class\.php\?aid=$1&bid=$2
RewriteRule^read/(+)/(+)/(+)\.html$read\.php\?aid=$1&bid=$2&cid=$3
RewriteRule^top/(.*)/(+)\.html$top\.php\?aid=$1&bid=$2
RewriteRule^list/(+)/(+)/index\.html$list\.php\?aid=$1&bid=$2
RewriteRule^initial/(.*?)/(.*?)\.html$initial\.php\?aid=$1&bid=$2

licess 发表于 2010-10-27 12:28:45

回复 8# 的帖子

请通过 http://blog.licess.org/convert-apache-htaccess-to-nginx/ 方法转换
页: [1]
查看完整版本: lnmp0.5 伪静态设置,走过路过进来帮帮忙