VPS侦探论坛

 找回密码
 注册
查看: 12571|回复: 8

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

[复制链接]
发表于 2010-10-22 22:13:06 | 显示全部楼层 |阅读模式

linode VPS  Centos 5.0 LNMP0.5

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

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

是修改nginx.conf 添加include wordpress.conf  吗?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-10-23 09:37:02 | 显示全部楼层

回复 1# 的帖子



修改wordpress.conf 将里面的location /   改成location /blog/
,再include到server里面既可以。
dede的直接include 上dede的伪静态就行。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2010-10-23 13:27:56 | 显示全部楼层

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



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


  1. user  www www;

  2. worker_processes 1;

  3. error_log  /home/wwwlogs/nginx_error.log  crit;

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

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

  7. events
  8.         {
  9.                 use epoll;
  10.                 worker_connections 51200;
  11.         }

  12. http
  13.         {
  14.                 include       mime.types;
  15.                 default_type  application/octet-stream;

  16.                 server_names_hash_bucket_size 128;
  17.                 client_header_buffer_size 32k;
  18.                 large_client_header_buffers 4 32k;
  19.                 client_max_body_size 8m;

  20.                 sendfile on;
  21.                 tcp_nopush     on;

  22.                 keepalive_timeout 60;

  23.                 tcp_nodelay on;

  24.                 fastcgi_connect_timeout 300;
  25.                 fastcgi_send_timeout 300;
  26.                 fastcgi_read_timeout 300;
  27.                 fastcgi_buffer_size 64k;
  28.                 fastcgi_buffers 4 64k;
  29.                 fastcgi_busy_buffers_size 128k;
  30.                 fastcgi_temp_file_write_size 256k;

  31.                 gzip on;
  32.                 gzip_min_length  1k;
  33.                 gzip_buffers     4 16k;
  34.                 gzip_http_version 1.0;
  35.                 gzip_comp_level 2;
  36.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  37.                 gzip_vary on;

  38.                 #limit_zone  crawler  $binary_remote_addr  10m;

  39. server
  40.         {
  41.                 listen       80;
  42.                 server_name www.025buyi.com 025buyi.com *.025buyi.com;
  43.                 index index.html index.htm index.php default.html default.htm default.php;
  44.                 root  /home/wwwroot/www.025buyi.com;

  45.                 include 025buyiwordpress.conf;include dedecms.conf                location ~ .*\.(php|php5)?$
  46.                         {
  47.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  48.                                 fastcgi_index index.php;
  49.                                 include fcgi.conf;
  50.                         }

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

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

  59.                 access_log off;
  60.         }

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

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

  69.                 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  70.              '$status $body_bytes_sent "$http_referer" '
  71.              '"$http_user_agent" $http_x_forwarded_for';
  72.                 access_log  /home/wwwlogs/access.log  access;
  73.         }
  74. include vhost/*.conf;
  75. }
复制代码



lnmp restart 后

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

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

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

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


请问军哥,偶哪里做错了?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-10-23 13:40:32 | 显示全部楼层

回复 3# 的帖子




重启过nginx没?/usr/local/nginx/sbin/nginx -t 测试看有错误没?
/root/lnmp restart 重启。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2010-10-23 13:42:53 | 显示全部楼层

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

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

发表于 2010-10-23 13:55:41 | 显示全部楼层

回复 5# 的帖子


.htaccess 对nginx不起作用
 楼主| 发表于 2010-10-23 14:22:34 | 显示全部楼层

  1. [root@li220-212 blog]# /usr/local/nginx/sbin/nginx -t
  2. [emerg]: "location" directive is not allowed here in /usr/local/nginx/conf/nginx                                       .conf:82
  3. configuration file /usr/local/nginx/conf/nginx.conf test failed
复制代码


82行出错?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2010-10-27 10:53:10 | 显示全部楼层

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

RewriteEngine on
RewriteRule  ^book/([0-9]+)\.html$  book\.php\?id=$1
RewriteRule  ^class/([0-9]+)/([0-9]+)\.html$  class\.php\?aid=$1&bid=$2
RewriteRule  ^read/([0-9]+)/([0-9]+)/([0-9]+)\.html$  read\.php\?aid=$1&bid=$2&cid=$3
RewriteRule  ^top/(.*)/([0-9]+)\.html$  top\.php\?aid=$1&bid=$2
RewriteRule  ^list/([0-9]+)/([0-9]+)/index\.html$  list\.php\?aid=$1&bid=$2
RewriteRule  ^initial/(.*?)/(.*?)\.html$  initial\.php\?aid=$1&bid=$2
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2010-10-27 12:28:45 | 显示全部楼层

回复 8# 的帖子

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

本版积分规则

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

GMT+8, 2024-9-8 08:03 , Processed in 0.027868 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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