Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess nginx重写url不工作_.htaccess_Nginx - Fatal编程技术网

.htaccess nginx重写url不工作

.htaccess nginx重写url不工作,.htaccess,nginx,.htaccess,Nginx,我正在尝试将新位置添加到我的nginx配置中。我设置了ngix帐户,以。现在我认为配置文件中最重要的一行是: include /usr/local/etc/nginx/sites-enabled/*; 因此,它包括站点启用文件夹中的所有配置文件。现在,我有一个默认的ssl配置文件和一个默认的ssl配置文件 server { listen 443; server_name localhost; root /var/www/; acces

我正在尝试将新位置添加到我的nginx配置中。我设置了ngix帐户,以。现在我认为配置文件中最重要的一行是:

include /usr/local/etc/nginx/sites-enabled/*;
因此,它包括
站点启用
文件夹中的所有配置文件。现在,我有一个默认的ssl配置文件和一个默认的ssl配置文件

server {
    listen       443;
    server_name  localhost;
    root       /var/www/;

    access_log  /usr/local/etc/nginx/logs/default-ssl.access.log  main;

    ssl                  on;
    ssl_certificate      ssl/localhost.crt;
    ssl_certificate_key  ssl/localhost.key;

    ssl_session_timeout  5m;

    ssl_protocols  SSLv2 SSLv3 TLSv1;
    ssl_ciphers  HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    location / {
        include   /usr/local/etc/nginx/conf.d/php-fpm;
    }

    location = /info {
        allow   127.0.0.1;
        deny    all;
        rewrite (.*) /.info.php;
    }

    error_page  404     /404.html;
    error_page  403     /403.html;
}
现在我想添加一个子文件夹
redux
。我用这个配置部分进行了尝试:

location = /redux {
            rewrite (.*) /redux/index.php;
        }
但它根本不起作用,我只收到以下错误消息:

015/09/15 10:10:41 [error] 844#0: *7 "/var/www/redux/user/login/index.html" is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "POST /redux/user/login/ HTTP/1.1", host: "localhost", referrer: "https://localhost/redux/"
但我所期望的是,/user/login部分作为参数提供给redux/index.php下的index.php

我需要改变什么

我的.htaccess看起来像这样

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(Templates|cache|uploads)($|/) - [L]
RewriteRule ^(.*)$ index.php [NC,L]

我的最终解决方案如下所示:

location /redux/ {
    try_files $uri $uri/ /redux/index.php?$args;
    include   /usr/local/etc/nginx/conf.d/php-fpm;
}