.htaccess 如何在NGINX服务器中配置Codeigniter。htaccess不工作

.htaccess 如何在NGINX服务器中配置Codeigniter。htaccess不工作,.htaccess,codeigniter,nginx,.htaccess,Codeigniter,Nginx,如何在NGINX服务器中配置Codeigniter。htaccess在这里不工作,我没有root权限。只有我可以上传文件使用FTP和可以访问数据库 在哪里可以使用此配置 server { server_name domain.tld; root /var/www/codeignitor; index index.html index.php; # set expiration of assets to MAX for c

如何在NGINX服务器中配置Codeigniter。htaccess在这里不工作,我没有root权限。只有我可以上传文件使用FTP和可以访问数据库

在哪里可以使用此配置

    server {
        server_name domain.tld;

        root /var/www/codeignitor;
        index index.html index.php;

        # set expiration of assets to MAX for caching
        location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
                expires max;
                log_not_found off;
        }

        location / {
                # Check if a file or directory index file exists, else route it to index.php.
                try_files $uri $uri/ /index.php;
        }

        location ~* \.php$ {
                fastcgi_pass 127.0.0.1:9000;
                include fastcgi.conf;
        }
}

Ref:

您应该与网络管理员联系,以访问配置文件/etc/nginx/conf.d/default.conf。需要正确配置以使路由正常工作。您可以像下面的代码一样配置nginx服务器文件以使路由正常工作

server{ listen 80; listen [::]:80; server_name 192.168.56.101 192.168.101.100 localhost; root /var/www/html; index index.php index.html index.htm; location / { try_files $uri $uri/ =404; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; } location /ci { try_files $uri $uri/ /ci/index.php?/$request_uri; }location ~ \.php$ { try_files $uri $uri/ /ci/index.php?/$request_uri; 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; } location ~ /\.ht { deny all; } }

询问您的云提供商,他们会告诉您。nginx不支持htaccess。