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
Apache 我需要翻译我的htaccess以便nginx工作_Apache_.htaccess_Mod Rewrite_Nginx - Fatal编程技术网

Apache 我需要翻译我的htaccess以便nginx工作

Apache 我需要翻译我的htaccess以便nginx工作,apache,.htaccess,mod-rewrite,nginx,Apache,.htaccess,Mod Rewrite,Nginx,嗯,我在我的旧apache配置(htaccess)中重写了这个mod_,我正在尝试将配置设置为nginx,但我不能真正理解它在nginx中是如何工作的,我是所有nginx东西的新手,有人能帮我翻译一下吗。。。事先非常感谢你 当前htacces文件: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !

嗯,我在我的旧apache配置(htaccess)中重写了这个mod_,我正在尝试将配置设置为nginx,但我不能真正理解它在nginx中是如何工作的,我是所有nginx东西的新手,有人能帮我翻译一下吗。。。事先非常感谢你

当前htacces文件:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^(/static/)

    RewriteRule . /app.php [L]
</IfModule>
server {
    server_name test.url;
    access_log /var/www/test.url/logs/access.log;
    error_log /var/www/test.url/logs/error.log;
    root /var/www/test.url/public_html/blank;

    location / {
        app.php;
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /var/www/test.url/public_html/$
    }
}
而不是:

location / {
    app.php;
}
尝试:

非常感谢。你让我开心;)我开始明白这一点。只有一件事,你忘记了“;”在“try_文件”的结尾。。。
location /static/ {
    # do nothing, we don't want to rewrite /static/
}

location / {
    try_files $uri $uri/ /app.php
}