【问题标题】:Codeigniter in Wordpress how to config NginxWordpress 中的 Codeigniter 如何配置 Nginx
【发布时间】:2015-11-20 19:05:34
【问题描述】:

找了半天没找到答案,在此先谢谢

这是我的目录: WordPress 在/var/projects/root /var/projects/root/codeigniter/中的代码点火器

这是我的 nginx 服务器配置:

listen 80;
server_name nginx.local.com;
root /var/projects/root;
error_log  /var/projects/log/error.log warn;
access_log  /var/projects/log/access.log main;

if ($host != 'nginx.local.com'){
   rewrite ^/(.*) http://nginx.local.com/$1 permanent;
}

location / {
    index index.php index.html index.html;
}

rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
if (!-e $request_filename) {
    rewrite ^.+?(/wp-.*) $1 last;
    rewrite ^.+?(/.*\.php)$ $1 last;
    rewrite ^ /index.php last;
}

location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

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

location /codeigniter {
    try_files $uri $uri/ /codeigniter/index.php?$query_string;
}

试过很多方法,Codeigniter变成了原码,现在只有http://nginx.local.com/codeigniterhttp://nginx.local.com/codeigniter/index.php可以访问(是欢迎页面)

以下页面是404 Not Found http://nginx.local.com/index.php/codeigniter/welcome/index http://nginx.local.com/codeigniter/welcome/index http://nginx.local.com/index.php/codeigniter/welcome/test

【问题讨论】:

    标签: php wordpress codeigniter nginx


    【解决方案1】:

    我尝试了解决方案。

    server {
        listen 80;
        server_name nginx.local.com;
        root /var/projects/root;
        error_log  /var/projects/log/error.log warn;
        access_log  /var/projects/log/access.log main;
    
        if ($host != 'nginx.local.com'){
           rewrite ^/(.*) http://nginx.local.com/$1 permanent;
        }
    
        location / {
            index index.php index.html index.html;
            if (!-e $request_filename) {
                rewrite ^.+?(/wp-.*) $1 last;
                rewrite ^.+?(/.*\.php)$ $1 last;
                rewrite ^ /index.php last;
            }
            rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
        }
    
        #Here is codeignter path
        location ~ /codeignter {
            try_files $uri $uri/ /index.php?$query_string;
            location ~ \.php($|/) {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  evindex.php;
                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param   PATH_INFO $fastcgi_path_info;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
            }
        }
    
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    
    }
    

    【讨论】:

      猜你喜欢
      • 2011-04-16
      • 2019-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-23
      • 2016-11-03
      • 1970-01-01
      • 2021-08-14
      相关资源
      最近更新 更多