cw723 发表于 2016-12-13 11:22:01

求助一个文件转换为nginx

# 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

# 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

谁知道怎么转换?

dabiantai 发表于 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规则论坛

今晚我是你的 发表于 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行是什么

dabiantai 发表于 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 合起来就是
if ( !-e $request_filename ) {
    rewrite.* $install_dir/index.php/$0 last;
}

cw723 发表于 2016-12-14 06:16:27


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

set $install_dir /plugins/support;

location~ \.* {
我去测试测试。

感谢

cw723 发表于 2016-12-14 05:50:00


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

set $install_dir /plugins/support;

location~ \.* {
重启的时候会出现

Stoping nginx... nginx: unknown "0" variable


这个错误

dabiantai 发表于 2016-12-14 06:23:00


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

重启的时候会出现

Stoping nginx... nginx: 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;
    }
}

inlife 发表于 2016-12-14 09:20:41

厉害了,楼上的程序员

cw723 发表于 2016-12-14 05:01:00


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

set $install_dir /plugins/support;

location~ /\..+ {
还是不行。

我打算把系统去做成LANMP得了。
页: [1]
查看完整版本: 求助一个文件转换为nginx