Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已解决] 第一次做站LNMP,请人搭建的环境,怎么开启伪静态啊,

[复制链接]
simawenhao 发表于 2010-10-29 00:52:40 | 显示全部楼层 |阅读模式
本帖最后由 simawenhao 于 2010-10-29 00:54 编辑

第一次做站,这么多年都潜水,请人帮忙配置的服务器环境,LNMP,我在后台查看 Rewrite 规则,显示如下面的。但是伪静态我点可用然后我访问不了,出现404页面,我该怎么做呢?我很白,希望能详细点或者基础点。求助热心人帮助   

  1. <IfModule mod_rewrite.c>
  2.         RewriteEngine On
  3.         RewriteCond %{QUERY_STRING} ^(.*)$
  4.         RewriteRule ^(.*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2&%1
  5.         RewriteCond %{QUERY_STRING} ^(.*)$
  6.         RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3&%1
  7.         RewriteCond %{QUERY_STRING} ^(.*)$
  8.         RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3&%1
  9.         RewriteCond %{QUERY_STRING} ^(.*)$
  10.         RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&%1
  11.         RewriteCond %{QUERY_STRING} ^(.*)$
  12.         RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3&%1
  13.         RewriteCond %{QUERY_STRING} ^(.*)$
  14.         RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3&%1
  15.         RewriteCond %{QUERY_STRING} ^(.*)$
  16.         RewriteRule ^(.*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3&%1
  17. </IfModule>

  18. Apache Web Server(虚拟主机用户)# 将 RewriteEngine 模式打开
  19. RewriteEngine On

  20. # 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
  21. RewriteBase /discuz

  22. # Rewrite 系统规则请勿修改
  23. RewriteCond %{QUERY_STRING} ^(.*)$
  24. RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
  25. RewriteCond %{QUERY_STRING} ^(.*)$
  26. RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
  27. RewriteCond %{QUERY_STRING} ^(.*)$
  28. RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
  29. RewriteCond %{QUERY_STRING} ^(.*)$
  30. RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
  31. RewriteCond %{QUERY_STRING} ^(.*)$
  32. RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
  33. RewriteCond %{QUERY_STRING} ^(.*)$
  34. RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
  35. RewriteCond %{QUERY_STRING} ^(.*)$
  36. RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1


  37. IIS Web Server(独立主机用户)[ISAPI_Rewrite]

  38. # 3600 = 1 hour
  39. CacheClockRate 3600

  40. RepeatLimit 32

  41. # Protect httpd.ini and httpd.parse.errors files
  42. # from accessing through HTTP
  43. RewriteRule ^(.*)/topic-(.+)\.html(\?(.*))*$ $1/portal\.php\?mod=topic&topic=$2&$4
  44. RewriteRule ^(.*)/article-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/portal\.php\?mod=view&aid=$2&page=$3&$5
  45. RewriteRule ^(.*)/forum-(\w+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=forumdisplay&fid=$2&page=$3&$5
  46. RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$6
  47. RewriteRule ^(.*)/group-([0-9]+)-([0-9]+)\.html(\?(.*))*$ $1/forum\.php\?mod=group&fid=$2&page=$3&$5
  48. RewriteRule ^(.*)/space-(username|uid)-(.+)\.html(\?(.*))*$ $1/home\.php\?mod=space&$2=$3&$5
  49. RewriteRule ^(.*)/([a-z]+)-(.+)\.html(\?(.*))*$ $1/$2\.php\?rewrite=$3&$5


  50. IIS7 Web Server(独立主机用户)<rewrite>
  51.         <rules>
  52.                 <rule name="portal_topic">
  53.                         <match url="^(.*/)*topic-(.+).html\?*(.*)$" />
  54.                         <action type="Rewrite" url="{R:1}/portal.php\?mod=topic&amp;topic={R:2}&amp;{R:3}" />
  55.                 </rule>
  56.                 <rule name="portal_article">
  57.                         <match url="^(.*/)*article-([0-9]+)-([0-9]+).html\?*(.*)$" />
  58.                         <action type="Rewrite" url="{R:1}/portal.php\?mod=view&amp;aid={R:2}&amp;page={R:3}&amp;{R:4}" />
  59.                 </rule>
  60.                 <rule name="forum_forumdisplay">
  61.                         <match url="^(.*/)*forum-(\w+)-([0-9]+).html\?*(.*)$" />
  62.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=forumdisplay&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
  63.                 </rule>
  64.                 <rule name="forum_viewthread">
  65.                         <match url="^(.*/)*thread-([0-9]+)-([0-9]+)-([0-9]+).html\?*(.*)$" />
  66.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=viewthread&amp;tid={R:2}&amp;extra=page%3D{R:4}&amp;page={R:3}&amp;{R:5}" />
  67.                 </rule>
  68.                 <rule name="group_group">
  69.                         <match url="^(.*/)*group-([0-9]+)-([0-9]+).html\?*(.*)$" />
  70.                         <action type="Rewrite" url="{R:1}/forum.php\?mod=group&amp;fid={R:2}&amp;page={R:3}&amp;{R:4}" />
  71.                 </rule>
  72.                 <rule name="home_space">
  73.                         <match url="^(.*/)*space-(username|uid)-(.+).html\?*(.*)$" />
  74.                         <action type="Rewrite" url="{R:1}/home.php\?mod=space&amp;{R:2}={R:3}&amp;{R:4}" />
  75.                 </rule>
  76.                 <rule name="all_script">
  77.                         <match url="^(.*/)*([a-z]+)-(.+).html\?*(.*)$" />
  78.                         <action type="Rewrite" url="{R:1}/{R:2}.php\?rewrite={R:3}&amp;{R:4}" />
  79.                 </rule>
  80.         </rules>
  81. </rewrite>

  82. Zeus Web Servermatch URL into $ with ^(.*)/topic-(.+)\.html\?*(.*)$
  83. if matched then
  84.         set URL = $1/portal.php?mod=topic&topic=$2&$3
  85. endif
  86. match URL into $ with ^(.*)/article-([0-9]+)-([0-9]+)\.html\?*(.*)$
  87. if matched then
  88.         set URL = $1/portal.php?mod=view&aid=$2&page=$3&$4
  89. endif
  90. match URL into $ with ^(.*)/forum-(\w+)-([0-9]+)\.html\?*(.*)$
  91. if matched then
  92.         set URL = $1/forum.php?mod=forumdisplay&fid=$2&page=$3&$4
  93. endif
  94. match URL into $ with ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html\?*(.*)$
  95. if matched then
  96.         set URL = $1/forum.php?mod=viewthread&tid=$2&extra=page\%3D$4&page=$3&$5
  97. endif
  98. match URL into $ with ^(.*)/group-([0-9]+)-([0-9]+)\.html\?*(.*)$
  99. if matched then
  100.         set URL = $1/forum.php?mod=group&fid=$2&page=$3&$4
  101. endif
  102. match URL into $ with ^(.*)/space-(username|uid)-(.+)\.html\?*(.*)$
  103. if matched then
  104.         set URL = $1/home.php?mod=space&$2=$3&$4
  105. endif
  106. match URL into $ with ^(.*)/([a-z]+)-(.+)\.html\?*(.*)$
  107. if matched then
  108.         set URL = $1/$2.php?rewrite=$3&$4
  109. endif


  110. Nginx Web Serverrewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
  111. rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
  112. rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
  113. rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
  114. rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
  115. rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
  116. rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
  117. if (!-e $request_filename) {
  118.         return 404;
  119. }

复制代码

xiaoyuwxz 发表于 2010-10-29 08:13:05 | 显示全部楼层
nginx.conf 或 vhost.conf的 server 段的        root   /home/wwwroot/htdocs; 下面加上以下的规则:
#discuzx rewrite
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
if (!-e $request_filename) {
        return 404;
}


回复

使用道具 举报

无效楼层,该帖已经被删除
 楼主| simawenhao 发表于 2010-10-29 12:20:33 | 显示全部楼层
回复

使用道具 举报

la367 发表于 2010-10-29 16:43:20 | 显示全部楼层
伪静态的情况,我不是很了解
回复

使用道具 举报

 楼主| simawenhao 发表于 2010-10-30 00:33:44 | 显示全部楼层
我一窍不通
回复

使用道具 举报

hellokai 发表于 2010-10-30 11:51:52 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

mistak 发表于 2010-10-30 13:56:30 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

 楼主| simawenhao 发表于 2010-11-2 04:28:52 | 显示全部楼层
这么多天,总算搞好了,哈哈,不过空间的跳转有问题
回复

使用道具 举报

928546 发表于 2010-11-2 04:58:06 | 显示全部楼层
我也搞了很久,可惜不会5555
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-5-18 15:23 , Processed in 0.098125 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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