Magento 1.8 的 Nginx 配置

2021-12-19 00:00:00 nginx magento mysql fastcgi

有人知道如何在nginx服务器的配置文件中配置server{}吗?我在下面有这样的东西:

anybody knows how to configure server {} in configuration file of nginx server? I have something like this below:

server {
  server_name   local.com;

  root some_path;

  index index.php;

  #location / {
    #try_files $uri $uri/ index.php;
    #proxy_pass  http://127.0.0.1:9000;
  #}

  # set a nice expire for assets
  #location ~* "^.+.(jpe?g|gif|css|png|js|ico|pdf|zip|tar|t?gz|mp3|wav|swf)$" {
  #  expires    max;
  #  add_header Cache-Control public;
  #}

  # the downloader has its own index.php that needs to be used
  #location ~* ^(/downloader|/js|/404|/report)(.*) {
  #  include fastcgi_params;
  #  fastcgi_index index.php;
  #  fastcgi_param  SCRIPT_FILENAME  $document_root$1/index.php$1;
  #  fastcgi_read_timeout 600;
  #  fastcgi_pass  127.0.0.1:9000;
  #}

  location ~* .php {
    include               fastcgi_params;
    fastcgi_param         SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_read_timeout  18000;
    fastcgi_pass          127.0.0.1:9000;
  }

  #location ~* ^(/index.php)?(.*) {
  #  include               fastcgi_params;
  #  fastcgi_param         SCRIPT_FILENAME  $document_root/index.php$1;
  #  fastcgi_pass          127.0.0.1:9000;
  #  fastcgi_read_timeout  18000;
  #}

}

浏览器返回空白页并且不执行 php...

Browser returns blank page and doesn't exec php...

在使用 nginx 配置和 php 的东西花了一些时间后,我最终拥有在某些情况下可以正确加载而在某些情况下无法正常加载的网站...

After spending some time with nginx configuration and php stuff i ended on having site that in some cases load properly and in some not...

例如:我有两个相同的页面,但出于某种原因,首先是加载谎言,然后是部分加载...

Ex: I have two pages that are identical, but for some reason first is loading lie a charm, and second is loading partially...

有时页面加载到一半...

Sometimes page is loading half way...

Nginx 没有记录任何东西...

Nginx isn't logging anything...

出于某种原因,当我尝试转到后端时,nginx 会使用后端 url 加载前端:/

And for some reason when i try to go to backend, nginx loads frontend with backend url :/

有人可以向我提供其他 magento 1.8 配置吗?

Does anybody can provide me with other magento 1.8 configuration ?

推荐答案

好吧,不是内存或数据库问题,是... IonCube 问题...我正在调试核心类,发现脚本在 Enteprise 上停止模块和...如果您没有安装 IonCube,它只会显示空白页面.

Ok, it wasn't memory or database issue, it was... IonCube issue... i was debuging core classes and found that script stops on Enteprise Modules and... if You don't have IonCube installed it just simply display blank page.

但是,现在 Magento 返回 404:找不到页面...

But, now Magento returns 404: Page not found...

谢谢,寻求帮助的人,如果您对第二个问题有任何建议,请随时在此处发布:)

Thx, guys for help and if You have some advice on second issue fell free to post it here :)

应用小修复后:

/* Store or website code */
$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
/* Run store or run website */
$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
Mage::run('', 'store'); //<-this
//Mage::run($mageRunCode, $mageRunType);

Front 和 Back 正在加载,但控制器有问题......但不会太久!

Front and Back are loading, but there is an problem with controllers... but not for long !

A,如果我输入 url/admin nginx 将返回找不到输入文件,但是当我输入 index.php/admin 时它会加载...部分.这是重写和服务器变量的问题.

A and if i type in url /admin nginx will return Input file not found, but when i type index.php/admin it load... part. It's and issue with rewrite and server vars.

我赢了!iconv 没有安装...现在一切正常,除了重写...

I won ! iconv wasn't installed... now everything work except rewriting...

总结:我需要找到一种方法来正确获取 index.php 文件的服务器 var 并将 index.php 重写为/

SUMMARY: I need to find a way to properly get server var for index.php file and rewrite index.php to /

感谢帮助!

相关文章