宝塔用户_vgpicj 发表于 2025-4-9 11:51:18

【已解答】phpstudy 系统 迁移到宝塔 网站不运行 请求帮助 ...

server {
      listen      80;
      server_namec1.aaa.cn ;
      root   "D:/phpstudy_pro/WWW/aqb";
      location / {
            index index.php index.html error/index.html;
            include D:/phpstudy_pro/WWW/aqb/nginx.htaccess;
            autoindexoff;
            if (!-e $request_filename)
            {
                rewrite ^/(.*)$ /index.php?s=/$1 last;
                break;
            }
      }

      location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }

}

以上 是部署在windowsPHP studypro8.1.1.3 版本上 环境php 7.3.4nts ,Nginx 1.15.11 ,Mysql 5.7.26 现 系统 网站正常运行 ,迁移到另外的windows 也没有问题

先迁移到Ubuntu , BT版本9.5.0 Nginx1.26.1 Php7.3.31 Mysql 5.7.44 ,配置如下



server
{
    listen 80;
    server_name c1.aaa.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/c1.aaa.cn;
    #CERT-APPLY-CHECK--START
    # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
    include /www/server/panel/vhost/nginx/well-known/c1.aaa.cn.conf;
    #CERT-APPLY-CHECK--END

    #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #SSL-END

    #ERROR-PAGE-START错误页配置,可以注释、删除或修改
    error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-STARTPHP引用配置,可以注释或修改
    include enable-php-73.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/c1.aaa.cn.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
      return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
      allow all;
    }


    #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
      return 403;
    }


    location ~ \.php$ {
    try_files $uri =404;# 先检查文件是否存在
    include fastcgi.conf;
    fastcgi_pass unix:/tmp/php-cgi-73.sock;
    fastcgi_index index.php;

    # 可选:调整超时时间
    fastcgi_read_timeout 60s;

    # 如果 fastcgi.conf 中没有,则需要保留这行
    # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}



    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
      error_log /dev/null;
      access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
      expires      12h;
      error_log /dev/null;
      access_log /dev/null;
    }


    access_log/www/wwwlogs/c1.aaa.cn.log;
    error_log/www/wwwlogs/c1.aaa.cn.error.log;
}

伪静态配置为


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


现在的问题是 bt 部署的系统 ,首页正常显示,点击其他链接 页面不跳转?各位亲谁给指导一下谢谢 谢谢

阿珂 发表于 2025-4-10 11:56:06


这段规则是重复的,可以去掉
将伪静态设置好
仍然有错误,则跟据网站日志具体分析

宝塔用户_vgpicj 发表于 2025-4-10 13:42:22

codeigniter 3.1.10 框架的系统 ,按您的提示没有解决问题

宝塔用户_vgpicj 发表于 2025-4-10 13:43:27

codeigniter 3.1.10 框架的网站 ,按您的提示 修改后 仍然只能显示网站首页 不能点击页面 跳转 ,后台 无错误提示

宝塔用户_vgpicj 发表于 2025-4-10 13:44:49

codeigniter 3.1.10 框架的网站 ,按您的提示 修改后 仍然只能显示网站首页 不能点击页面 跳转 ,后台 无错误提示

阿珂 发表于 2025-4-11 16:36:13

没有用过这个框架,你可以去他们官网看看有没有相关的教程
页: [1]
查看完整版本: 【已解答】phpstudy 系统 迁移到宝塔 网站不运行 请求帮助 ...