独立站PrestaShop安装

独立站PrestaShop安装

独立站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:

bash 复制代码
CURL
DOM
Fileinfo
GD
Intl
Mbstring
Zip
JSON
Iconv

Useful server tools:

Cron/Crontab, Memcached.

下载PrestaShop

浏览器下载

下载页面

bash 复制代码
https://github.com/PrestaShop/PrestaShop/releases

命令行下载

bash 复制代码
wget https://github.com/PrestaShop/PrestaShop/archive/refs/tags/8.1.7.tar.gz

解压PrestaShop

bash 复制代码
tar -zxvf 8.1.7.tar.gz

创建数据库

移动PrestaShop源码到web目录

bash 复制代码
mv /usr/local/src/8.1.7/* /www/wwwroot/www.prestashop817.com/

composer安装依赖包

bash 复制代码
composer install


注: 安装过程中symfony老是会安装失败,请多次尝试

nginx配置

bash 复制代码
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

bash 复制代码
chmod 0777 modules -R

刷新信息

店铺信息

Content of your store

系统配置数据库


店铺安装

在这里插入图片描述

命令行脚本安装

如果页面安装失败报504错误且多次尝试无果,请采用安装脚本进行安装

进入安装目录

bash 复制代码
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

bash 复制代码
cd app/config
rm -f parameters.yml
rm -f parameters.php

执行安装脚本

bash 复制代码
chmod 0777 var/ -R
cd ..
chown www:www www.prestashop817.com/ -R
cd www.prestashop817.com/install-dev
bash 复制代码
php index_cli.php --domain=www.prestashop817.com --db_server=127.0.0.1 --db_name=prestashop_817 --db_user=root --db_password=123456789
相关推荐
老谭聊跨境10 天前
FP独立站引流革命:GG斗篷技术解锁流量新策略
跨境电商·独立站·外贸独立站
出海笔记2 个月前
独立站技能树/工具箱1.0 总纲篇丨出海笔记
跨境电商·独立站·独立站运营·出海笔记
东哥聊跨境4 个月前
跨境电商独立站:Shopify/Wordpress/店匠选哪个?
跨境电商·外贸·独立站
老谭聊跨境5 个月前
2024年已过半,靠独立站赚钱行得通吗?
跨境电商·外贸·拼多多·独立站·海外掘金
老谭聊跨境9 个月前
从入门到精通:AB跳转轮询的操作指南
科技·跨境电商·独立站·独立站收款·黑科技操作·独立站运营·跨境电商独立站
wmdage1 年前
海外社媒营销避坑指南:盘点最容易被人忽视的7大坑!
品牌出海·营销推广·跨境电商·海外社媒营销·独立站
老谭聊跨境1 年前
一文详解FP独立站引流全攻略
科技·其他·流量运营·独立站·跨境出海
danplus1 年前
外贸建站要国外服务器吗?海外服务器推荐?
服务器·独立站·外贸独立站·自建站·外贸自建站·独立站建站·独立站搭建
danplus1 年前
外贸自建站服务器怎么选?网站搭建的工具?
独立站·外贸独立站·自建站·外贸自建站·跨境独立站·独立站建站·独立站搭建