本文主要是介绍独立站PrestaShop安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
独立站PrestaShop安装
- 独立站PrestaShop安装
- 系统需求
- 下载PrestaShop
- 浏览器下载
- 命令行下载
- 解压PrestaShop
- 创建数据库
- 移动PrestaShop源码到web目录
- composer安装依赖包
- nginx配置
- 访问域名进入安装页面
- 选择语言
- 许可协议
- 系统兼容性
- 店铺信息
- Content of your store
- 系统配置数据库
- 店铺安装
- 命令行脚本安装
- 进入安装目录
- 安装脚本参数
- 删除parameters.yml和parameters.php
- 执行安装脚本
独立站PrestaShop安装
系统需求
System: Unix, Linux, or Windows.
MySQL: 5.7 or later.
PHP: 8.1 or later.
In your php.ini file:
Useful settings
allow_url_fopen set to “On” ✅,
register_globals set to “Off” ❌,
upload_max_filesize set to “16MB” or more.
Must have PHP extensions:
CURL
DOM
Fileinfo
GD
Intl
Mbstring
Zip
JSON
Iconv
Useful server tools:
Cron/Crontab, Memcached.
下载PrestaShop
浏览器下载
下载页面
https://github.com/PrestaShop/PrestaShop/releases
命令行下载
wget https://github.com/PrestaShop/PrestaShop/archive/refs/tags/8.1.7.tar.gz
解压PrestaShop
tar -zxvf 8.1.7.tar.gz
创建数据库
移动PrestaShop源码到web目录
mv /usr/local/src/8.1.7/* /www/wwwroot/www.prestashop817.com/
composer安装依赖包
composer install
注: 安装过程中symfony老是会安装失败,请多次尝试
nginx配置
server
{listen 80;server_name www.prestashop817.com;index index.php index.html index.htm default.php default.htm default.html;root /www/wwwroot/www.prestashop817.com;#CERT-APPLY-CHECK--START# 用于SSL证书申请时的文件验证相关配置 -- 请勿删除include /www/server/panel/vhost/nginx/well-known/www.prestashop817.com.conf;#CERT-APPLY-CHECK--END#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则#error_page 404/404.html;#SSL-END#ERROR-PAGE-START 错误页配置,可以注释、删除或修改error_page 404 /404.html;#error_page 502 /502.html;#ERROR-PAGE-END#PHP-INFO-START PHP引用配置,可以注释或修改## include enable-php-81.conf;#PHP-INFO-END#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效location / {try_files $uri $uri/ /index.php$is_args$args;}location /admin-dev/ {try_files $uri $uri/ /admin-dev/index.php$is_args$args;}#REWRITE-END#禁止访问的文件或目录location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md){return 404;}#一键申请SSL证书验证目录相关设置location ~ \.well-known{allow all;}#禁止在证书验证目录放入敏感文件if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {return 403;}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)${expires 30d;error_log /dev/null;access_log /dev/null;}location ~ .*\.(js|css)?${expires 12h;error_log /dev/null;access_log /dev/null;}access_log /www/wwwlogs/www.prestashop817.com.log;error_log /www/wwwlogs/www.prestashop817.com.error.log;####################prestashop官方配置##############################client_max_body_size 16M;error_page 404 /index.php?controller=404;# Images.rewrite ^/(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last;rewrite ^/(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.jpg last;rewrite ^/(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4.jpg last;rewrite ^/(\d)(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;rewrite ^/(\d)(\d)(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;rewrite ^/(\d)(\d)(\d)(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;rewrite ^/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;rewrite ^/(\d)(\d)(\d)(\d)(\d)(\d)(\d)(\d)(-[\w-]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;rewrite ^/c/([\w.-]+)/.+\.jpg$ /img/c/$1.jpg last;# AlphaImageLoader for IE and FancyBox.rewrite ^images_ie/?([^/]+)\.(gif|jpe?g|png)$ js/jquery/plugins/fancybox/images/$1.$2 last;# Web service API.rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;# Installation sandbox.rewrite ^(/install(?:-dev)?/sandbox)/.* /$1/test.php last;# .htaccess, .DS_Store, .htpasswd, etc.location ~ /\. {deny all;}# Source code directories.location ~ ^/(app|bin|cache|classes|config|controllers|docs|localization|override|src|tests|tools|translations|var|vendor)/ {deny all;}# vendor in modules directory.location ~ ^/modules/.*/vendor/ {deny all;}# Prevent exposing other sensitive files.location ~ \.(log|tpl|twig|sass|yml)$ {deny all;}# Prevent injection of PHP files.location /img {location ~ \.php$ { deny all; }}location /upload {location ~ \.php$ { deny all; }}location ~ [^/]\.php(/|$) {# Split $uri to $fastcgi_script_name and $fastcgi_path_info.fastcgi_split_path_info ^(.+?\.php)(/.*)$;# Ensure that the requested PHP script exists before passing it# to the PHP-FPM.try_files $fastcgi_script_name =404;# Environment variables for PHP.include fastcgi_params;fastcgi_param SCRIPT_FILENAME $request_filename;fastcgi_index index.php;fastcgi_keep_conn on;proxy_connect_timeout 100s;fastcgi_read_timeout 100s;fastcgi_send_timeout 100s;# Uncomment these in case of long loading or 502/504 errors.# fastcgi_buffer_size 256k;# fastcgi_buffers 256 16k;# fastcgi_busy_buffers_size 256k;# [EDIT] Connection to PHP-FPM unix domain socket.fastcgi_pass unix:/tmp/php-cgi-81.sock;}}
访问域名进入安装页面
选择语言
注: 首次安装程序会下载中文语言包,可自行连接VPN保证下载成功
许可协议
系统兼容性
我们web服务用的是nginx报错是Aapche,这是安装程序的BUG
我们修改项目目录的modules目录及里面的文件权限为0777
chmod 0777 modules -R
刷新信息
店铺信息
Content of your store
系统配置数据库
店铺安装
在这里插入图片描述
命令行脚本安装
如果页面安装失败报504错误且多次尝试无果,请采用安装脚本进行安装
进入安装目录
cd install-dev
安装脚本参数
To start the installation, you need to 5 arguments:
domain. The location where you want your store to appear.
db_server. The database server address.
db_name. The name of the database you want to use.
db_user. The username for the database you want to use.
db_password. The password for the database username used above.
删除parameters.yml和parameters.php
如果之前进行过页面安装操作需要删除app/config/parameters.yml和app/config/parameters.php
cd app/config
rm -f parameters.yml
rm -f parameters.php
执行安装脚本
chmod 0777 var/ -R
cd ..
chown www:www www.prestashop817.com/ -R
cd www.prestashop817.com/install-dev
php index_cli.php --domain=www.prestashop817.com --db_server=127.0.0.1 --db_name=prestashop_817 --db_user=root --db_password=123456789
这篇关于独立站PrestaShop安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!