我不确定此问题已被解答了多少次,但我所看到的每个答案都提供了一种不同的方法来解决这个问题,而这些问题都没有奏效.我正在从Apache迁移到Nginx,并且在设置它时遇到了一些严重的问题.我的/ etc/nginx/sites-available/default看起来像这样......
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www/flo2go/;
index index.php index.html index.htm;
if ($request_filename !~ (js|css|images|robots\.txt|index\.php.*) ) {
rewrite ^/(.*)$ /index.php/$1 last;
}
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.php;
# Uncomment to enable naxsi on this …Run Code Online (Sandbox Code Playgroud)