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

求助一个文件转换为nginx

[复制链接]

1612

主题

5443

回帖

1万

积分

论坛元老

积分
15818
发表于 2016-12-13 11:22:01 | 显示全部楼层 |阅读模式
# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /plugins/support

# Protect hidden files from being viewed

        Order Deny,Allow
        Deny From All


# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

谁知道怎么转换?
回复

使用道具 举报

11

主题

135

回帖

311

积分

中级会员

积分
311
发表于 2016-12-14 05:01:23 | 显示全部楼层
本帖最后由 dabiantai 于 2016-12-14 06:16 编辑

set $install_dir /plugins/support;

location  ~ \.* {
    deny all;
}

rewrite ^(?:application|modules|system)\b.* $install_dir/index.php/$0;

location / {
    if ( !-e $request_filename ) {
        rewrite  .* $install_dir/index.php/$0 last;
    }
}

全球nginx规则论坛
回复

使用道具 举报

207

主题

1879

回帖

4391

积分

论坛元老

积分
4391
发表于 2016-12-14 05:50:17 | 显示全部楼层

dabiantai 发表于 2016-12-14 05:01

set $install_dir /plugins/support;

location  .* {

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

那这2行是什么
回复

使用道具 举报

11

主题

135

回帖

311

积分

中级会员

积分
311
发表于 2016-12-14 05:01:00 | 显示全部楼层

今晚我是你的 发表于 2016-12-14 05:50

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAM ...

和底下的RewriteRule .* index.php/$0 [PT]合起来就是
if ( !-e $request_filename ) {
    rewrite  .* $install_dir/index.php/$0 last;
}
回复

使用道具 举报

1612

主题

5443

回帖

1万

积分

论坛元老

积分
15818
 楼主| 发表于 2016-12-14 06:16:27 | 显示全部楼层

dabiantai 发表于 2016-12-14 05:01

set $install_dir /plugins/support;

location  ~ \.* {

我去测试测试。

感谢
回复

使用道具 举报

1612

主题

5443

回帖

1万

积分

论坛元老

积分
15818
 楼主| 发表于 2016-12-14 05:50:00 | 显示全部楼层

dabiantai 发表于 2016-12-14 05:01

set $install_dir /plugins/support;

location  ~ \.* {

重启的时候会出现

Stoping nginx... nginx: [emerg] unknown "0" variable


这个错误
回复

使用道具 举报

11

主题

135

回帖

311

积分

中级会员

积分
311
发表于 2016-12-14 06:23:00 | 显示全部楼层

cw723 发表于 2016-12-14 09:25

重启的时候会出现

Stoping nginx... nginx: [emerg] unknown "0" variable

set $install_dir /plugins/support;

location  ~ /\..+ {
    deny all;
}

rewrite ^/((?:application|modules|system)\b.*) $install_dir/index.php/$1 last;

location / {
    if ( !-e $request_filename ) {
        rewrite  (.*) $install_dir/index.php/$1 last;
    }
}
回复

使用道具 举报

4

主题

98

回帖

218

积分

中级会员

积分
218
发表于 2016-12-14 09:20:41 | 显示全部楼层
厉害了,楼上的程序员
回复

使用道具 举报

1612

主题

5443

回帖

1万

积分

论坛元老

积分
15818
 楼主| 发表于 2016-12-14 05:01:00 | 显示全部楼层

dabiantai 发表于 2016-12-14 10:58

set $install_dir /plugins/support;

location  ~ /\..+ {

还是不行。

我打算把系统去做成LANMP得了。
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-2-7 12:15 , Processed in 0.019427 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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