Magento 1.8 的 Nginx 配置
有人知道如何在 nginx 服务器的配置文件中配置 server {} 吗? 我有如下类似的内容:
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...
编辑:
在花了一些时间进行 nginx 配置和 php 内容之后,我最终得到了在某些情况下可以正确加载的网站,而在某些情况下则不能...
前任: 我有两个相同的页面,但由于某种原因,第一个是加载一个魅力,第二个是部分加载...
有时页面加载到一半...
Nginx 没有记录任何内容...
并且出于某种原因,当我尝试转到后端,nginx 使用后端 url 加载前端:/
有人可以为我提供其他 magento 1.8 配置吗?
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;
#}
}
Browser returns blank page and doesn't exec php...
EDIT:
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 isn't logging anything...
And for some reason when i try to go to backend, nginx loads frontend with backend url :/
Does anybody can provide me with other magento 1.8 configuration ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在
index
指令之后(实际上在哪里并不重要,只是为了便于阅读)添加 try_files 指令。偶然我写了一个更完整的指南:为 Magento 配置 nginx
After the
index
directive (actually it doesn't matter where, it's just for legibility) add a try_files directive.By chance I wrote a fuller guide on this: Configuring nginx for Magento
好吧,这不是内存或数据库问题,而是... IonCube 问题...我正在调试核心类,发现脚本在企业模块上停止并且...如果您没有安装 IonCube,它只是简单地显示空白页。
但是,现在 Magento 返回 404:页面未找到...
谢谢,大家帮忙,如果您对第二个问题有一些建议,可以随意将其发布在这里:)
应用小修复后:
正面和背面正在加载,但有一个控制器有问题...但不会持续很长时间!
A,如果我输入 url /admin nginx 将返回未找到输入文件,但是当我输入 index.php/admin 时它会加载...部分。这是重写和服务器变量的问题。
编辑:
我赢了! iconv 没有安装...现在除了重写之外一切正常...
摘要:
我需要找到一种方法来正确获取index.php文件的服务器var并将index.php重写为/
谢谢帮助!
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.
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 :)
After applying little fix:
Front and Back are loading, but there is an problem with controllers... but not for long !
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.
EDIT:
I won ! iconv wasn't installed... now everything work except rewriting...
SUMMARY:
I need to find a way to properly get server var for index.php file and rewrite index.php to /
Thx for help !
在回答后面关于 MAGE_RUN_CODE 的问题时,您可以使用 nginx 映射来完成。请参阅:Coeus Blue 博客文章
In answer to the latter questions about MAGE_RUN_CODE you can do it with the nginx map. See: Coeus Blue Blog Post