VPS侦探论坛

 找回密码
 注册
查看: 5497|回复: 4

军哥救命, 论坛大神救命!! 关于伪静态规则的破事!

[复制链接]
发表于 2012-7-10 00:55:21 | 显示全部楼层 |阅读模式

论坛大佬们帮小弟解决个问题吧,这个问题困扰了我N久了!
我正在使用一款国外的图床程序,是CF Image Host 1.6版,我需要把程序自带的“.htaccess”规则转换成“Nginx”规则, 网上找了N久全是用不了的,也许是我操作有问题吧,反正我转换的规则全是不能用的!

程序自带的.htaccess文件内容如下:
# ----------------------------------------------------------------------
# gzip compression
# ----------------------------------------------------------------------
<IfModule mod_deflate.c>

        # force deflate for mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/
        <IfModule mod_setenvif.c>
                <IfModule mod_headers.c>
                        SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)s,?s(gzip|deflate)?|X{4,13}|~{4,13}|-{4,13})$ HAVE_Accept-Encoding
                        RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
                </IfModule>
        </IfModule>

        # html, txt, css, js, json, xml, htc:
        <IfModule filter_module>
                FilterDeclare   COMPRESS
                FilterProvider  COMPRESS  DEFLATE resp=Content-Type /text/(html|css|javascript|plain|x(ml|-component))/
                FilterProvider  COMPRESS  DEFLATE resp=Content-Type /application/(javascript|json|xml|x-javascript)/
                FilterChain     COMPRESS
                FilterProtocol  COMPRESS  change=yes;byteranges=no
        </IfModule>

        <IfModule !mod_filter.c>
        # Legacy versions of Apache
                AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
                AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
                AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
        </IfModule>

</IfModule>

# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
<IfModule mod_expires.c>
        ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
        ExpiresDefault                          "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
        ExpiresByType text/cache-manifest       "access plus 0 seconds"

# your document html
        ExpiresByType text/html                 "access plus 0 seconds"

# data
        ExpiresByType text/xml                  "access plus 0 seconds"
        ExpiresByType application/xml           "access plus 0 seconds"
        ExpiresByType application/json          "access plus 0 seconds"

# rss feed
        ExpiresByType application/rss+xml       "access plus 1 hour"

# favicon
        ExpiresByType image/x-icon              "access plus 1 week"

# media: images
        ExpiresByType image/gif                 "access plus 1 month"
        ExpiresByType image/png                 "access plus 1 month"
        ExpiresByType image/jpg                 "access plus 1 month"
        ExpiresByType image/jpeg                "access plus 1 month"

# css and javascript
        ExpiresByType text/css                  "access plus 2 months"
        ExpiresByType application/javascript    "access plus 2 months"
        ExpiresByType text/javascript           "access plus 2 months"

        <IfModule mod_headers.c>
                Header append Cache-Control "public"
        </IfModule>
  
</IfModule>


# ETag removal
        FileETag none

<IfModule mod_rewrite.c>
RewriteEngine on
        ErrorDocument 400 /index.php?err=400
        ErrorDocument 401 /index.php?err=401
        ErrorDocument 403 /index.php?err=403
        ErrorDocument 404 /index.php?err=404
        ErrorDocument 500 /index.php?err=500
#image view
        RewriteRule ^pm-(.*).(jpg|jpeg|png|gif|html)$ thumbnail.php?pm=$1 [L]
        RewriteRule ^pt-(.*).(jpg|jpeg|png|gif|html)$ thumbnail.php?pt=$1 [L]
        RewriteRule ^dt-(.*).(jpg|jpeg|png|gif)$ image.php?dt=$1 [L]
        RewriteRule ^dm-(.*).(jpg|jpeg|png|gif)$ image.php?dm=$1 [L]
        RewriteRule ^di-(.*).(jpg|jpeg|png|gif|bmp)$ image.php?di=$1 [L]
        RewriteRule ^dl-(.*).(jpg|jpeg|png|gif|bmp)$ image.php?dl=$1 [L]
        
        RewriteRule ^pm/(.*)/(.*).(jpg|jpeg|png|gif|html)$ thumbnail.php?pm=$1 [L]
        RewriteRule ^pt/(.*)/(.*).(jpg|jpeg|png|gif|html)$ thumbnail.php?pt=$1 [L]
        RewriteRule ^dt/(.*)/(.*).(jpg|jpeg|png|gif)$ image.php?dt=$1 [L]
        RewriteRule ^dm/(.*)/(.*).(jpg|jpeg|png|gif)$ image.php?dm=$1 [L]
        RewriteRule ^di/(.*)/(.*).(jpg|jpeg|png|gif|bmp)$ image.php?di=$1 [L]
        RewriteRule ^dl/(.*)/(.*).(jpg|jpeg|png|gif|bmp)$ image.php?dl=$1 [L]
#Not Found
        RewriteRule ^(pm|pt)/(.*)/(.*)$ thumbnail.php?pm=notfound [L]
        RewriteRule ^(dt|dm|di|dl)/(.*)/(.*)$ index.php?di=notfound [L]

#Gallery
        RewriteRule ^gallery/$ gallery.php [L]
        RewriteRule ^gallery/([0-9]+)/$ gallery.php?p=$1 [L]
        RewriteRule ^gallery/(.*)/([0-9]+)/$ gallery.php?p=$2&o=$1 [L]
        RewriteRule ^gallery/([A-Za-z])/page([0-9]+).html$ gallery.php?p=$2&o=$1 [L]
#sitemap
        RewriteRule ^sitemap.xml$ sitemap.php [L]
</IfModule>





---------------------------------------------------------
请论坛大佬帮我转换下在 Nginx环境下可以使用的规则,,,  对了,,因为之前小弟操作了N久没有成功,所以请大佬们顺便说下具体的操作过程,我好鉴定下操作有没有失误............

军哥快点现身,,帮小弟把规则转换下啊,,,,  救命...................










跪拜大神出现,,

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


自己在论坛里搜索早就发过了
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-7-11 21:12:18 | 显示全部楼层

原帖由 licess 于 2012-7-10 07:43 发表
自己在论坛里搜索早就发过了


军歌,你发的那个规则我看过啊,用了之后不行啊,图片什么的全是404错误!!

能说说加这个规则的过程吗?   我知道您老很忙啊,  抽百忙之空给我回复下吧。。  小白你伤不起。。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2012-7-12 00:16:39 | 显示全部楼层



哦,对了 军哥! 你以前在论坛发布的那个规则 最新版本用不了了.. 以前的老版本和pro版本可以使用。。

你可以看看我上面发布的最新版本 .htaccess文件内容。。  我希望您可以帮我从这个文件中转换出针对新版可以使用的规则!

谢谢
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-7-12 00:47:10 | 显示全部楼层

好了,, 我已经搞定了!

多些各位。。

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

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

本版积分规则

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

GMT+8, 2024-9-23 11:22 , Processed in 0.026969 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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