Yii 1.1路径无法在远程服务器

时间:2017-09-08 10:52:46

标签: php yii yii-components

我是Yii的新手,我在远程服务器上设置配置时遇到了麻烦。 在本地,一切都很好,但在服务器上,使用完全相同的GH repo,包括config / main.php,没有任何链接似乎工作。

例如,在网站/索引中,我有一个指向/ video / index的链接 但是,每当我点击链接时,路径就会添加如下:/ site / video / index。并反复按下它将在前面添加更多/视频/。(/ site / video / video / video / video / index)。 - >请注意,这只发生在服务器上而不是本地。

我尝试过的东西:在浏览器栏中手动插入漂亮和丑陋的网址,没有任何效果。实际上,我在.com(.com / asdfbfdgvdipgfbsd /)之后添加的任何内容都将呈现网站/索引页面,我写的路径保留在栏中,但内容不是错误或其他任何内容,只是我的主索引文件。

我如何设法访问视频页面:

  1. 设置'defaultUrl'=> '/ video / index'(而不是网站/索引),但这没有用,因为显然我现在只能访问此页面。

  2. 评论'urlFormat'=>'路径'---->这允许我从我的站点/索引页面进入视频页面,但这会导致浏览器中显示以下路径:/ video /?r = video / index。现在,在这个页面中,我显示了20个视频缩略图,并包含了一个自动加载库(magicScroller)。在本地它工作正常,当我向下滚动时添加更多的拇指。但是,在服务器的这个配置中,我没有渲染更多的拇指,而是在第一批视频批次下面呈现/ site / index页面。

  3. 这是我的'组件' - >来自main.php配置文件的UrlManager:

    'urlManager'=>array(
        //'urlFormat'=>'path',
        'showScriptName'=>false,
        'rules'=>array(
          '<controller:\w+>/<id:\d+>'=>'<controller>/view',              
          '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
          '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
        ),
    ),
    

    我尝试添加'enablePrettyUrl'=&gt; true,但这会导致错误:未定义属性“CUrlManager.enablePrettyUrl”。

    请注意。本地一切都很完美,路径看起来很正常(没有双/视频/视频或任何特殊的东西)

    不知道还有什么可以检查和尝试,所以期待听到这个聪明的思想社区:)

    编辑: 这是配置。也许它对我的问题有所了解

     server {
         listen       80;
         server_name my.site.com;
    
         #charset koi8-r;
         access_log  /var/log/nginx/my.site.com.access main;
         root   /www/my.site.com/public;
    
         location / {
             index  index.html index.php;
             try_files $uri $uri/ index.php?$args;
         }
    
         error_page  404              /404.html;
    
         # redirect server error pages to the static page /50x.html
         #
         error_page   500 502 503 504  /50x.html;
         location = /50x.html {
    
         }
    
         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
         location ~ \.php {
              fastcgi_split_path_info  ^(.+\.php)(.*)$;
    
              #let yii catch the calls to unexising PHP files
              set $fsn /index.php;
              if (-f $document_root$fastcgi_script_name){
                  set $fsn $fastcgi_script_name;
              }
    
              #fastcgi_pass   127.0.0.1:9000;
              fastcgi_pass   unix:/var/run/fastcgi.sock;
              include fastcgi_params;
              fastcgi_param  SCRIPT_FILENAME  $document_root$fsn;
    
              #PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies  them for CGI
              fastcgi_param  PATH_INFO        $fastcgi_path_info;
              fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
         }
    
         location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml|map)$ {
             try_files         $uri $uri/ =404;
             #log_not_found     off;
             expires           1d;
         }
    
         # deny access to .htaccess files, if Apache's document root
         # concurs with nginx's one
         #
         #location ~ /\.ht {
         #    deny  all;
         #}
     }
    

0 个答案:

没有答案