Alibaba Cloud Linux 3 安装部署 ECStore B2C V5.0.1 社区版
ECStore B2C V5.0.1 是商派于2018年7月份宣布開源時推出的最后一個開源社區版(后面還有個5.0.2 商業版),目前該系列產品都已下架,現階段正在主推 ECshopX 系列。
注:本文所有操作都在 root 賬戶下進行,所有操作也同樣適應 AnolisOS 8.x。php5.6.40 使用 el8 rpm 安裝。?
一、初始化 dnf 源
1、下載并配置 epel(RHEL 8),參考:https://developer.aliyun.com/mirror/epel
2、創建并配置 remi.repo
cat > /etc/yum.repos.d/remi.repo <<EOF > # This repository only provides packages for the PHP stack > > [remi] > name=Remi's RPM repository for Enterprise Linux 8 - $basearch > baseurl=https://mirrors.aliyun.com/remi/enterprise/8/remi/$basearch/ > enabled=1 > gpgcheck=1 > gpgkey=https://rpms.remirepo.net/RPM-GPG-KEY-remi2018 EOF二、安裝配置 php 環境
1、安裝 php5.6.40 及必要擴展,完成后輸入 php56 -m 確認所有已安裝的擴展
dnf -y install php56-php t1lib php56-php-bcmath php56-php-gd php56-php-mbstring php56-php-mcrypt php56-php-xml php56-php-process php56-php-pdo php56-php-mysqlnd php56-php-pecl-redis4 php56-php-pecl-memcached2、創建 www 組、www 用戶
groupadd www useradd -c "HTTPD User" -g www www -s /sbin/nologin3、創建 /srv/httpd 目錄,同時將?ECStore-xxx.tar 源碼包解壓到該目錄。然后再將該目錄所屬用戶和組都設置成 www
mkdir /srv/httpd tar xvf /路徑/ECStore-Community-php5.6-5.0.1.tar -C /srv/httpd chown -R www:www /srv/httpd4、給以下目錄設置必要的寫入權限
cd /srv/httpd/ecstore chmod ug+w config data public public/images public/files themes5、安裝?Swoole Loader擴展(必要擴展)
(1) 查看當前所裝 php 的默認擴展目錄
php56 -i | grep extension_dir 結果:extension_dir => /opt/remi/php56/root/usr/lib64/php/modules(2) 將 ECStrore 源碼包中的?swoole_loader56.so 擴展文件復制到 php 的默認擴展目錄
cp /srv/httpd/ecstore/deploy/swoole_loader56.so /opt/remi/php56/root/usr/lib64/php/modules(3) 在 /etc/opt/remi/php56/php.d 下新建文件 60-swoole_loader.ini,使用 cat 創建如下:
cat > 60-swoole_loader.ini <<EOF > ; 注意這里的 .so 如果不是在 php 的默認擴展目錄中,需要使用全局文件路徑。 > extension = swoole_loader56.so EOF6、打開 /etc/opt/remi/php56/php.ini
(1) 定位到 cgi.fix_pathinfo,確認其已被注釋(默認值是1)或者去掉注釋后將其值設為1
(2) 定位到 date.timezone,去掉注釋并設置 date.timezone = "Asia/Shanghai"。保存并退出
7、打開?/etc/opt/remi/php56/php-fpm.d/www.conf
(1)?確保 php-fpm 模塊使用 www?用戶和 www?用戶組的身份運行
; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. ; RPM: apache user chosen to provide access to the same directories as httpd user = www ; RPM: Keep a group allowed to write in log dir. group = www(2) 緊接上面用戶設置的下面一段,確認接收 FastCGI 請求的監聽方式,本例為 Unix Socket。后面在配置 Nginx?fastcgi_pass 時,也要設成 Unix Socket。保存并退出。
; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; ; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on ; a specific port; ; 'port' - to listen on a TCP socket to all IPv4 addresses on a ; specific port; ; '[::]:port' - to listen on a TCP socket to all addresses ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. listen = /var/opt/remi/php56/run/php-fpm/www.sock重要:必須將 www.sock 的所有者和所屬組都分配給 www
chown www:www /var/opt/remi/php56/run/php-fpm/www.sock8、禁用 httpd.service、httpd.socket 開機自啟動(防止 httpd 占用 80 端口導致 Nginx 不能啟動)
systemctl disable httpd.service systemctl disable httpd.socket systemctl stop httpd.service systemctl stop httpd.socket9、重啟?php56-php-fpm.service
systemctl restart php56-php-fpm.service10、配置定時任務,輸入?crontab -uwww -e 回車,輸入以下內容后保存并退出
* * * * * /srv/httpd/ecstore/script/queue/queue.sh /usr/bin/php56 >/dev/null * * * * * /usr/bin/php56 /srv/httpd/ecstore/script/crontab/crontab.php >/dev/null三、安裝配置 Nginx 環境
1、安裝Nginx
dnf -y nginx2、打開?/etc/nginx/fastcgi_params 注釋掉?SCRIPT_NAME 所在行
# fastcgi_param SCRIPT_NAME $fastcgi_script_name;3、打開 /etc/nginx/nginx.conf 配置 Unix Socket 及?PATH_INFO,配置中的 user 必須要添加一個?www
user nginx www; ...... 省略 ......http {...... 省略 ......server {listen 80;listen [::]:80;server_name boge.com;# Load configuration files for the default server block.include /etc/nginx/default.d/*.conf;location / {root /srv/httpd/ecstore;if (!-e $request_filename) {rewrite ^/(.*)$ /index.php/$1 last;}index index.php index.html index.htm;}location ~ ^/shopadmin {rewrite ^/(.*)$ /index.php/$1 last;break;}location ~ \.php {root /srv/httpd/ecstore;fastcgi_pass unix:/var/opt/remi/php56/run/php-fpm/www.sock;fastcgi_index index.php;include fastcgi_params;set $real_script_name $fastcgi_script_name;if ($fastcgi_script_name ~ "(.+?.php)(/.+)") {set $real_script_name $1;set $path_info $2;}fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;fastcgi_param SCRIPT_NAME $real_script_name;fastcgi_param PATH_INFO $path_info;}} }4、重啟 Nginx
nginx -s stop nginx后面?MySQL、Redis、Memcached 的安裝配置就不再贅述了。
總結
以上是生活随笔為你收集整理的Alibaba Cloud Linux 3 安装部署 ECStore B2C V5.0.1 社区版的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 贝叶斯定理 php,朴素贝叶斯及贝叶斯网
- 下一篇: ecstore网站换服务器,ECStor