任何人都可以为 hmvc 结构完成 Codeigniter 设置和 nginx 吗? 请帮助我,我尝试在 nginx 上设置 codeigniter HMVC 结构。但多次失败。请建议一些配置方法。
我正在使用 php7.0-fpm。
我的nginx配置文件是
server {
listen 80;
root /var/www/html/salsetrack;
index index.html index.htm index.php;
server_name local.sales-track.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
index index.html index.php;
try_files $uri $uri/ @handler;
expires 30d;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
try_files $uri =404;
#Include Nginx’s fastcgi configuration
include /etc/nginx/fastcgi.conf;
#Look for the FastCGI Process Manager at this location
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location @handler {
rewrite / /index.php;
}}
最佳答案
可以引用https://www.nginx.com/resources/wiki/start/topics/recipes/codeigniter/用于 codeigniter 的 nginx 配置。
关于php - 为 hmvc 结构使用 nginx 的 Codeigniter 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53736280/