您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
nginx-安装ecshop
发布时间:2017-11-23 12:27:43编辑:雪饮阅读()
解压ecshop
unzip ECShop_2.7.3_UTF8_release1230.zip
进入解压后的目录中移动upload并重命名为ecshop
mv upload /usr/local/nginx/html/ecshop
nginx的server中添加index.php为默认文档:
server {
listen 80;
server_name localhost;
root /usr/local/nginx/html;
location / {
index index.php index.html;
}
location ~* \.(jpg|jpeg|gif|png) {
expires 1d;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}
}
然后nginx -s reload重载下配置并启动php-fpm
安装:
(1)将移动并重命名后的ecshop目录中如下目录及其子目录的权限都设置成777
data/ 目录及其所有子目录
temp/ 目录及其所有子目录
cert/ 目录
includes/ 目录及其所有子目录
images/ 目录及其所有子目录
themes/ 目录及其所有子目录
chmod -R 777 /usr/local/nginx/html/ecshop/data
chmod -R 777 /usr/local/nginx/html/ecshop/temp
chmod -R 777 /usr/local/nginx/html/ecshop/cert
chmod -R 777 /usr/local/nginx/html/ecshop/includes
chmod -R 777 /usr/local/nginx/html/ecshop/images
chmod -R 777 /usr/local/nginx/html/ecshop/themes
或
chmod o+w /usr/local/nginx/html/ecshop/data -R
chmod o+w /usr/local/nginx/html/ecshop/temp -R
chmod o+w /usr/local/nginx/html/ecshop/cert -R
chmod o+w /usr/local/nginx/html/ecshop/includes -R
chmod o+w /usr/local/nginx/html/ecshop/images -R
chmod o+w /usr/local/nginx/html/ecshop/themes –R
o+w:o表示档案所有者所属组的组外人员,w表示对该档案的“写”权限
(2) 处理用localhost数据库连接失败
因为linux下用localhost连接时并不走tcp/ip协议而是通过socket连接,如果socket文件不存在则连接失败。
可以用127.0.0.1来代替localhost,这样就可以通过tcp/ip协议来连接了。
如果非要用localhost则在php.ini中指定socket位置如:
mysql.default_socket =/var/lib/mysql/mysql.sock
报错编辑后杀死php-fpm并再次启动php-fpm
pkill -9 php-fpm
/usr/local/fastphp/sbin/php-fpm
注意:mysql.sock如果不存在有可能是你的mysql服务器是新安装的,没有启动过,启动下应该就有了。至于位置如果是通过yum安装的,一般就是/var/lib/mysql/mysql.sock
(3)处理时区
在php.ini中将时区修改为中华人民共和国的时区,如:
date.timezone =PRC
同样需要重启php-fpm
(4)修改源码
(4-1)
将ecshop目录中includes/init.php中
/**
* ECSHOP 前台公用文件
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liubo $
* $Id: init.php 17217 2011-01-19 06:29:08Z liubo $
*/
if (!defined('IN_ECS'))
{
die('Hacking attempt');
}
error_reporting(E_ALL);
修改为:
/**
* ECSHOP 前台公用文件
* ============================================================================
* * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
* 网站地址: http://www.ecshop.com;
* ----------------------------------------------------------------------------
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
* 使用;不允许对程序代码以任何形式任何目的的再发布。
* ============================================================================
* $Author: liubo $
* $Id: init.php 17217 2011-01-19 06:29:08Z liubo $
*/
if (!defined('IN_ECS'))
{
die('Hacking attempt');
}
error_reporting(0);
将
/* 初始化设置 */
@ini_set('memory_limit', '64M');
@ini_set('session.cache_expire', 180);
@ini_set('session.use_trans_sid', 0);
@ini_set('session.use_cookies', 1);
@ini_set('session.auto_start', 0);
@ini_set('display_errors', 1);
修改为
/* 初始化设置 */
@ini_set('memory_limit', '64M');
@ini_set('session.cache_expire', 180);
@ini_set('session.use_trans_sid', 0);
@ini_set('session.use_cookies', 1);
@ini_set('session.auto_start', 0);
@ini_set('display_errors', 0);
将
if ((DEBUG_MODE & 1) == 1)
{
error_reporting(E_ALL);
}
else
{
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
}
if ((DEBUG_MODE & 4) == 4)
{
include(ROOT_PATH . 'includes/lib.debug.php');
}
/* 判断是否支持 Gzip 模式 */
修改为(相当于删除掉标记有颜色部分的代码):
/* 判断是否支持 Gzip 模式 */
(4-2)
在ecshop下将install/includes/init.php中
/* ±¨¸æËùÓдíÎó */
@ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_NOTICE);
改为:
/* ±¨¸æËùÓдíÎó */
@ini_set('display_errors', 0);
error_reporting(0);
(5)完成安装
浏览器访问如
进行安装
在安装步骤中的设置数据库信息界面处记得勾选“安装测试数据”
安装完成后通过引导进入首页如
关键字词:nginx,安装,ecshop