CODEIGNITER-Nginx-config可以读取子文件夹,但不能读取子文件夹中的uri



这里是我的配置。

server {
listen 80;
server_name domain.com;
if ($http_x_forwarded_proto = "http") {
    return 301 https://domain.com$request_uri;
}
if (!-e $request_filename){
    rewrite ^/(.*)$ /index.php?/$1 last;
    break;
}
#proxy_cache_path /usr/local/nginx/cache  levels=1:2 keys_zone=STATIC:10m i$
include  mime.types;
default_type application/octet-stream;
gzip  on;

root /var/www/domain.com/html;
index  index.php index.html;
location / {
    rewrite ^(.*)$ /index.php;
}
location /x {
    try_files $uri $uri/ /x/index.php?$args;
}
location ~ ^/(images|js|css)/(.*)$ {
    try_files $uri $uri/;
}
location ~* .(?:ico|css|js|gif|jpe?g|png)$ {
        root  /images;
        expires max;
        add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* .(eot|ttf|woff)$ {
    add_header Access-Control-Allow-Origin *;
    break;
}
location ~ .php$ {
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}
}

我一整天都在想。

可以访问domain.com/x/ or domain.com/x/index.php但不能访问domain.com/x/welcomedomain.com/x/index.php/welcome

流量

domain.com=代码点火器框架

domain.com/x=代码点火器框架

大多数情况下,我尝试使用CCD_ 4也没有成功,即使我尝试了这个也不能成功rewrite ^/(.*)$ /index.php?/$1 last;

请参阅位置/x

只需移除即可成功访问

if (!-e $request_filename){
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}

相关内容

最新更新