Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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 如何将htaccess转换为NGINX?_.htaccess_Nginx - Fatal编程技术网

.htaccess 如何将htaccess转换为NGINX?

.htaccess 如何将htaccess转换为NGINX?,.htaccess,nginx,.htaccess,Nginx,请告诉我如何在这个例子中将htaccess转换为NGINX <IfModule mod_rewrite.c> Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404] RewriteCond %{REQUEST_FILENAME} !-f

请告诉我如何在这个例子中将htaccess转换为NGINX

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

选项-多视图
重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写规则\(js | css | jpeg | jpg | gif | png | ico)(\?$)-[L,NC,R=404]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]

Apache让事情看起来有点复杂。但Nginx中的相同配置非常简单

root /var/www/html;

location ~* \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) {
   try_files $uri =404;
}

location / {
   try_files $uri $uri/ /index.php;
}

location ~ \.php {
   # <your fastcgi php handling config>
}
root/var/www/html;
位置*\(js | css | jpeg | jpg | gif | png | ico)(\?|$){
try_files$uri=404;
}
地点/{
尝试_文件$uri$uri//index.php;
}
位置~\.php{
# 
}