全球主机交流论坛

标题: 求转换规则(apache转nginx) [打印本页]

作者: 立华奏    时间: 2012-2-11 20:59
标题: 求转换规则(apache转nginx)
RewriteEngine On
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php
Rewritebase /
RewriteRule ^(.*)xx(.+)\.jsp$  $1product.php?rule=$2
RewriteRule ^(.*)lb(.+)\.jsp$ $1list.php?rule=$2
RewriteRule ^(.*)dp(.+)\.jsp$  $1shopsearch.php?rule=$2
RewriteRule ^(.*)tp(.+)\.jsp$ $1pic.php?rule=$2
RewriteRule ^(.*)shop-(.+)\.jsp$ $1shop.php?rule=$2

求手工转换
作者: oldghost    时间: 2012-2-11 21:00
额,这个还真不会
作者: 立华奏    时间: 2012-2-11 21:01
没人会吗- -
作者: ㄒiger    时间: 2012-2-11 21:04
手工不会。。
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/


if ($rule_0 = ""){
rewrite ^/(.*)xx(.+).jsp$ /;
}
if ($rule_1 = ""){
rewrite ^/(.*)lb(.+).jsp$ /$1list.php?rule=$2;
}
if ($rule_2 = ""){
rewrite ^/(.*)dp(.+).jsp$ /;
}
if ($rule_3 = ""){
rewrite ^/(.*)tp(.+).jsp$ /$1pic.php?rule=$2;
}
if ($rule_4 = ""){
rewrite ^/(.*)shop-(.+).jsp$ /$1shop.php?rule=$2;
}
作者: 立华奏    时间: 2012-2-11 21:07
ㄒiger 发表于 2012-2-11 21:04
手工不会。。
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

表示粘贴完就无法启动nginx了
作者: 立华奏    时间: 2012-2-11 21:08
[root@278088 conf]# /root/lnmp start
=========================================================================
Manager for LNMP V0.8  ,  Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org

Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================================
Starting LNMP...
nginx: [emerg] unknown "rule_0" variable
Nginx start successfully!
php-fpm is runing!
MySQL is runing!
作者: 立华奏    时间: 2012-2-11 21:24

作者: mb2004    时间: 2012-2-11 21:40
提示: 作者被禁止或删除 内容自动屏蔽
作者: UCVPS    时间: 2012-2-11 21:58
立华奏 发表于 2012-2-11 21:08
[root@278088 conf]# /root/lnmp start
=============================================================== ...

试试把规则弄到外面
作者: 立华奏    时间: 2012-2-11 22:06
UCVPS 发表于 2012-2-11 21:58
试试把规则弄到外面

怎么弄?
作者: loveminds    时间: 2012-2-11 22:08
用这个转换http://www.onexin.net/rewrite.php

rewrite ^/(.*)xx(.+).jsp$  $1product.php?rule=$2 /;
rewrite ^/(.*)lb(.+).jsp$ /$1list.php?rule=$2 last;
rewrite ^/(.*)dp(.+).jsp$  $1shopsearch.php?rule=$2 /;
rewrite ^/(.*)tp(.+).jsp$ /$1pic.php?rule=$2 last;
rewrite ^/(.*)shop-(.+).jsp$ /$1shop.php?rule=$2;

以下是我加的
error_page 403 /403.php;
error_page 404 /404.php;
error_page 500 /404.php;
作者: UCVPS    时间: 2012-2-11 23:51
立华奏 发表于 2012-2-11 22:06
怎么弄?

里面写上include xxx.conf;
在上一级文件夹新建一个xxx.conf 复制内容进去 重启lmp




欢迎光临 全球主机交流论坛 (https://sunk.eu.org/) Powered by Discuz! X3.4