未来往事
把艰辛的奋斗看作是生命的必然,即使没有收获的希望也心平气和的继续。 [2018年 第50周/共52周]

http跳转https_设置指定目录不跳转nginx rewrite

今天遇到需求是在访问url网址需要实现部分路径不进行https跳转,之前nginx设置的是对全部http url进行301跳转到https协议,具体实现的nginx rewrite如下:

  1. set $is_jump 0;
  2. if ( $request_uri ~ ^/post
......
+阅读全文

Bo-blog IIS Nginx Rewrite伪静态规则

适用于:bo-blog2.X以上版本  Windows IIS站点主机和Nginx主机

IIS ISAPI_Rewrite:
[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32

# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
#Bo-Blog 2.1.1 Release ISAPI_Rewrite http://fity.cn
RewriteRule ^(.*)/post/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/read\.php\?entryid=$2&page=$3&part=$4
RewriteRule ^(.*)/page/([0-9]+)/([0-9]+)/?$ $1/index\.php\?mode=$2&page=$3
RewriteRule ^(.*)/starred/([0-9]+)/?([0-9]+)?/?$ $1/star.php\?mode=$2&page=$3
RewriteRule ^(.*)/category/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=category_$2&mode=$3&page=$4
RewriteRule ^(.*)/archiver/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=archive&cm=$2&cy=$3&mode=$4&page=$5
RewriteRule ^(.*)/date/([0-9]+)/([0-9]+)/([0-9]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/index\.php\?go=showday_$2-$3-$4&mode=$5&page=$6
RewriteRule ^(.*)/user/([0-9]+)/?$ $1/view\.php\?go=user_$2
RewriteRule ^(.*)/tags/([^/]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/tag\.php\?tag=$2&mode=$3&page=$4
RewriteRule ^(.*)/component/id/([0-9]+)/?$ $1/page\.php\?pageid=$2
RewriteRule ^(.*)/component/([^/]+)/?$ $1/page\.php\?pagealias=$2

#Customized URL
#RewriteRule ^(.*)/([^\/]*)\.html$ $1/$2/ [I]
RewriteRule ^(.*)/([^/|.]+)/?([0-9]+)?/?([0-9]+)?/?$ $1/read.php\?blogalias=$2&page=$3&part=$4 [I]

#fity.cn伪RSS XML订阅页面
RewriteRule ^(.*)/rss.xml$ $1/feed\.php
RewriteRule ^(.*)/sitemap.xml$ $1/sitemap\.php


Nginx Rewrite:也是本站当前在用的
+阅读全文

Apache Rewrite规则转Nginx Rewrite规则

不知道怎么把Apache Rewrite 规则转换成Nginx Rewrite配置的童鞋可以通过一个自动化的linux命令行工具apache2nginx进行Rewrite规则转换。

使用apache2nginx能将apache的配置文件转换成相应的nginx的配置文件。源代码在github上:
https://github.com/nhnc-nginx/apache2nginx

使用方法:
apache2nginx -f /etc/httpd/conf/httpd.conf  将生成 nginx.conf


另外还可以在线转换:
Apache转换到Nginx Rewrite:
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

Apache、Lighttpd、IIS转换到Nginx Rewrite:
http://www.onexin.net/rewr......
+阅读全文

discuz 7.2 Nginx URL重写规则

rewrite ^/archiver/((fid|tid)-[w-]+.html)$ /archiver/index.php?$1 last;

rewrite ^/forum-([0-9]+)-([0-9]+).html$ /forumdisplay.php?fid=$1&page=$2 last;

rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;

rewrite ^/space-(username|uid)-(.+).html$ /space.php?$1=$2 last;

rewrite ^/tag-(.+).html$ /tag.php?name=$1 last;

break;


......
+阅读全文

Nginx 常用的URL重定向方法

本文将以一些实例简单对Nginx的一些常用的URL重写方法做个简要的介绍。废话这里也不多说了哈,下面就转入正题。

1. 在 Apache 中的写法
RewriteCond  %{HTTP_HOST}  nginx.org
RewriteRule  (.*)          http://www.nginx.org$1


在 Nginx 可以对应写成:
server {
    listen       80;
    server_name  www.nginx.org  nginx.org;
  &n
......
+阅读全文