你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu 安装 StartBBS 出错和解决办法

[日期:2013-10-08] 来源:Linux社区  作者:Linux [字体:大 中 小]

Ubuntu 安装 StartBBS 出错和解决办法

Ubuntu 12.04

php-5.3.27

mysql-5.1.68

nginx-1.4.2

安装之前需要做以下配置(app/config/config.php):

$config['base_url'] = 'http://www.linuxidc.com/';
$config['index_page'] = 'index.php';

2.1 安装出现 404 错误
在 nginx 的 nginx.conf 文件中添加

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

如下:

# www.linuxidc.com
server {
    listen 80;
    server_name www.linuxidc.com;

    location / {
        root /home/wzw/workstation/www/linuxidc.com;
        index index.php index.htm index.html;
        autoindex on;     
    }

    #location = /50x.html {
    # root /home/wzw/workstation/www/linuxidc.com;
    #}
 
    location ~ \.php.*$ {
        root /home/wzw/workstation/www/linuxidc.com;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
   
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?$1 last;
            # rewrite "^/(.*)$" /index.php last;
            # break;
        }
    }
}

2.2 js 和 css 文件不能加载,报404 错误,页面的数据是正常的,即php部分是正常的
这个问题让我抓狂了差不多一天,主要也是我自己对nginx还不熟吧。

之所以出现这个问题,是因为2.1中添加的那段配置的位置很关键,我之前将其放在 location / {…} 中,后来也尝试了放在
location / {…} 外,都导致同样问题的发生。最后我移到 location ~ \.php.*$ {…} 就好了。

更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

linux
相关资讯       StartBBS  StartBBS安装 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 匿名 发表于 2013/10/19 16:31:23
楼主,有意思吗,引用我的博文也不注明出处?!