1
我有一个非常简单的.htaccess
文件,我需要在转换为nginx的配置:转换阿帕奇重写规则到nginx的配置文件
RewriteRule ^api$ api.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
我试图这样做,使一个开始:
location/{
rewrite ^(.*)$ /index.php;
}
但每当我加载我的网页的基本URL我的浏览器只是下载index.php文件。我也有这个在我的配置:
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
但由于某种原因nginx仍然通过它作为下载。这里的配置是什么?
这不是一个htaccess,Apache的,或重写问题。这是一个nginx/fastcgi配置问题。 –
fastcgi规则与其他一切工作。我有其他脚本运行在服务器上使用相同的配置,他们工作正常,我认为这只是重写规则阻止它运行,而是下载文件给用户。 –