Php Nginx上的Magento-配置
我正在编写一个nginx.conf来运行Magento,该站点主要运行,Magento是使用Php Nginx上的Magento-配置,php,magento,nginx,tinymce,Php,Magento,Nginx,Tinymce,我正在编写一个nginx.conf来运行Magento,该站点主要运行,Magento是使用PHPFPM运行的 但是它的某些部分仍然不起作用,我尝试了网络上的每一个wiki、博客等 我的问题是,每当我在CMS页面和块上出现Javascript弹出窗口时,主要是tiny_mce WYSIWYG编辑器(/js/tiny_mce/plugins/advimage/image.htm等),它们就会打开一个未找到的页面 我不知道该怎么做才能正确显示此编辑器 此外,下载器不显示 似乎每一个都在不同于root
PHPFPM
运行的
但是它的某些部分仍然不起作用,我尝试了网络上的每一个wiki、博客等
我的问题是,每当我在CMS页面和块上出现Javascript弹出窗口时,主要是tiny_mce WYSIWYG编辑器(/js/tiny_mce/plugins/advimage/image.htm等),它们就会打开一个未找到的页面
我不知道该怎么做才能正确显示此编辑器
此外,下载器不显示
似乎每一个都在不同于root的文件夹中使用自己的index.php,所以我应该将索引更改为该文件夹吗
如
$document\u root/downloader/index.php
?您必须将所有.htaccess规则重写到ngnix配置中才能使其正常工作。值得一读我们已将magento安装到mydomain.com/store,我们使用下一个nginx配置:
server {
listen <needed ip(s)>:80;
server_name mydomain.com;
root /www/mydomain;
location ~ /\. {
deny all;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
access_log off;
expires 30d;
}
location /store/ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/store/index.php;
fastcgi_param SCRIPT_NAME /store/index.php;
fastcgi_index index.php;
}
location /store/static/ { }
location /store/skin/ { }
location /store/media/ { }
location /store/errors/ { }
location ~* /store/errors/.*\.xml$ { deny all; }
location ~* /store/errors/.*\.phtml$ { deny all; }
location ~* /store/errors/.*\.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME /store/errors$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_read_timeout 600;
}
location /store/js/ { }
location ~* /store/js/.*\.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/store/js$fastcgi_script_name;
fastcgi_param SCRIPT_NAME /store/js$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_read_timeout 600;
}
}
服务器{
听:80;
服务器名称mydomain.com;
root/www/mydomain;
位置~/\{
否认一切;
}
位置~*^.+(jpg | jpeg | gif | css | png | js | ico)${
访问/注销;
过期30天;
}
地点/店铺/{
fastcgi_pass 127.0.0.1:9000;
包括fastcgi_参数;
fastcgi_param SCRIPT_FILENAME$document_root/store/index.php;
fastcgi_param SCRIPT_NAME/store/index.php;
fastcgi_index.php;
}
位置/存储/静态/{}
位置/商店/皮肤/{}
位置/存储/媒体/{}
位置/存储/错误/{}
位置~*/store/errors/*\.xml${deny all;}
位置~*/store/errors/*\.phtml${deny all;}
位置~*/store/errors/*\.php${
fastcgi_pass 127.0.0.1:9000;
包括fastcgi_参数;
fastcgi\参数脚本\文件名$document\根$fastcgi\脚本\名称;
fastcgi_参数SCRIPT_NAME/store/errors$fastcgi_SCRIPT_NAME;
fastcgi_index.php;
fastcgi_读取超时600;
}
location/store/js/{}
位置~*/store/js/*\.php${
fastcgi_pass 127.0.0.1:9000;
包括fastcgi_参数;
fastcgi_参数SCRIPT_FILENAME$document_root/store/js$fastcgi_SCRIPT_name;
fastcgi_参数SCRIPT_NAME/store/js$fastcgi_SCRIPT_NAME;
fastcgi_index.php;
fastcgi_读取超时600;
}
}
我强烈建议您阅读并遵循以下步骤
我对Magento使用以下配置。它不仅工作得很好,它还关闭了图像等的访问日志,并且有一个特殊的php fpm配置。请注意,服务器根目录是在服务器块中指定的。多个配置文件在位置块中错误地指定了它
Magento nginx配置文件:
(请确保相应地替换所有路径和域名)
这是一个特定于php fpm的配置文件,它可以截获错误代码并正确分割路径信息,这样您就可以访问php中正确的路径部分。由于性能提高,我还使用Unix套接字而不是端口。还请注意,您不需要重复fastcgi_参数中已经指定的fastcgi_参数
fastcgi_intercept_errors on;
# this will allow Nginx to intercept 4xx/5xx error codes
# Nginx will only intercept if there are error page rules defined
# -- This is better placed in the http {} block as a default
# -- in that virtual host's server block
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# A handy function that became available in 0.7.31 that breaks down
# The path information based on the provided regex expression
# This is handy for requests such as file.php/some/paths/here/
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/phpfpm.sock;
}
我的fastcgi_参数配置文件针对小型服务器进行了优化在这种情况下,SE网络总是会妨碍人们帮助他人。当象牙塔队来到这里并关闭有用的信息时,受挫的用户应该考虑向网站管理员或Serverfault发帖。哦,顺便说一下,我刚刚打了个招呼,以便重新开放,这似乎是主持人的不好。I don’我从来没有使用过nginx,所以它必须保持关闭状态。:PI我遇到了同样的问题,我正在尝试下面的答案,但我的问题是,我们在哪里允许nginx读取tinyimce-js:
fastcgi_intercept_errors on;
# this will allow Nginx to intercept 4xx/5xx error codes
# Nginx will only intercept if there are error page rules defined
# -- This is better placed in the http {} block as a default
# -- in that virtual host's server block
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# A handy function that became available in 0.7.31 that breaks down
# The path information based on the provided regex expression
# This is handy for requests such as file.php/some/paths/here/
include fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/phpfpm.sock;
}
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_connect_timeout 90;
fastcgi_send_timeout 180;
fastcgi_read_timeout 360;
fastcgi_buffer_size 1024k;
fastcgi_buffers 8 512k;
fastcgi_busy_buffers_size 1024k;
fastcgi_temp_file_write_size 1024k;
fastcgi_intercept_errors on;
fastcgi_pass_header *;