Configurations nginx php5-fpm (change domain.com)
server {
listen 80 default;
server_name domain.com;
root /var/www/domain.com;
access_log /var/log/nginx/domain.com.access_log;
error_log /var/log/nginx/domain.com.error_log;
index index.php;
try_files $uri @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php/$1;
}
location ~ \.php {
fastcgi_index index.php;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
This code not working with the root path...
Examples:
domain.com/parse/a/b --> works domain.com/parse --> works
domain.com --> Not working
The following should help you fix the problem:
Change try_files $uri @rewrite
to try_files $uri $uri/ @rewrite
Change rewrite ^/(.*)$ /index.php/$1;
to rewrite ^/(.*)$ /index.php?/$1 last;
to prevent an infinite rewrite loop.
If this does not fix it, let me know and I'll look into it further.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.