php – 用于hmvc结构的nginx的Codeigniter设置教程
任何人都可以使用nginx为Codemiter设置hmvc结构吗?
请帮我这个,我尝试在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配置.