Aws安装magento2.3.5记录 + lnmp
Aws安装magento2.3.5记录 + lnmp
1magento2安装包下载
https://magento.com/tech-resources/download
2 Install LNMP
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp
php version 7.2.32
lnmp vhost add
domain.amazonaws.com
vim /usr/local/nginx/conf/ domain.amazonaws.com.conf
server {
server_name domain.amazonaws.com ;
listen 80;
location / {
root /home/wwwroot/ domain.amazonaws.com ;
index index.html index.php;
if (!-e $request_filename){
rewrite ^/(.*) /index.php last;
}
}
location ~ \.php$ {
root /home/wwwroot/ domain.amazonaws.com ;
fastcgi_pass unix:/tmp/php-cgi.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME /home/wwwroot/ domain.amazonaws.com $fastcgi_script_name;
# include fastcgi_params;
}
}
3 Install Magento2
3.1upload magento-ce-2.3.5-p2_sample_data-2020-07-27-09-17-19.zip on
/home/wwwroot/domain.com
And unzip it
2.2 mysql -h domain.com -u admin -p
Create new database magento2
2.3 run command
php -dmemory_limit=6G bin/magento setup:install \
--base-url= domain.com \
--db-host= domain.com \
--db-name=magento2 \
--db-user=admin \
--db-password=password \
--backend-frontname=admin \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=HKD \
--timezone=Asia/Hong_Kong \
--use-rewrites=1
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush
after that ,will saw home page and admin page js&css lost
2.4 connect mysql
Use database magento2;
insert core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);
2.5
rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/*
php bin/magento setup:static-content:deploy -f
done
php -f bin/magento cron:run
报错
In Shell.php line 55:The exec function is disabled
解决方法
vim /usr/local/php/etc/php.ini
在php.ini中找到“disable_functions=passthru,system,exec,……”
删除其中的“exec”,保存。
lnmp restart
加入购物车报错
Validate class not found from basename 'Magento\Framework\Validator\EmailAddress'
1、原因: php配置自动加载找不到zendframework中的email验证类。
2、解决: 修改php.ini中的include_path为include_path="." 以下是php.ini的部分配置信息,只要找到此处,在; UNIX: "/path1:/path2"下复制一行;include_path = ".:/php/includes"去掉前面的;号,把值替换成"."就可以了。