找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 94|回复: 9

求转换规则(apache转nginx)

[复制链接]

3

主题

40

回帖

99

积分

注册会员

积分
99
发表于 2012-2-11 20:59:11 | 显示全部楼层 |阅读模式
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

求手工转换
回复

使用道具 举报

116

主题

1907

回帖

4196

积分

论坛元老

积分
4196
发表于 2012-2-11 21:00:56 | 显示全部楼层
额,这个还真不会
回复

使用道具 举报

3

主题

40

回帖

99

积分

注册会员

积分
99
 楼主| 发表于 2012-2-11 21:01:40 | 显示全部楼层
没人会吗- -
回复

使用道具 举报

324

主题

3595

回帖

8214

积分

论坛元老

积分
8214
发表于 2012-2-11 21:04:06 | 显示全部楼层


手工不会。。
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;
}
回复

使用道具 举报

3

主题

40

回帖

99

积分

注册会员

积分
99
 楼主| 发表于 2012-2-11 21:07:54 | 显示全部楼层

ㄒiger 发表于 2012-2-11 21:04



手工不会。。
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

表示粘贴完就无法启动nginx了
回复

使用道具 举报

3

主题

40

回帖

99

积分

注册会员

积分
99
 楼主| 发表于 2012-2-11 21:04:00 | 显示全部楼层
[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!
回复

使用道具 举报

3

主题

40

回帖

99

积分

注册会员

积分
99
 楼主| 发表于 2012-2-11 21:08:45 | 显示全部楼层


回复

使用道具 举报

23

主题

260

回帖

619

积分

高级会员

积分
619
发表于 2012-2-11 21:24:30 | 显示全部楼层

立华奏 发表于 2012-2-11 21:08



[root@278088 conf]# /root/lnmp start
=============================================================== ...

试试把规则弄到外面
回复

使用道具 举报

36

主题

1780

回帖

3706

积分

论坛元老

积分
3706
发表于 2012-2-11 21:40:26 | 显示全部楼层

UCVPS 发表于 2012-2-11 21:58



试试把规则弄到外面

怎么弄?用这个转换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;
回复

使用道具 举报

0

主题

1

回帖

4

积分

新手上路

积分
4
发表于 2012-2-11 21:58:43 | 显示全部楼层

立华奏 发表于 2012-2-11 22:06



怎么弄?

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

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Discuz! X

GMT+8, 2025-4-21 18:54 , Processed in 0.028248 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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