The configuration of lamp server and other commands in CentOS 7 have changed. CentOS 7 and above can also be installed and configured according to this document.

aaPanel integrated environment is recommended. Tutorial step by step using aaPanel integrated environment installation tutorial

Server configuration requirements: operating system: Linux; Web server: nginx (recommended) > = 1.8.0; PHP version: = 5.4;
MariaDB:= 5.5.6;Memcached:>= 1.4.2;PHP Extension:memcached fileinfo openssl Zend Guard Loader;
Download address:https://www.zend.com/en/products/loader/downloads#Linux

Close firewall:CentOS 7.0 7.2 Firewall is used as the firewall by default

        systemctl stop firewalld.service #停止firewall
        systemctl disable firewalld.service #禁止firewall开机启动

Close SELINUX

        vi /etc/selinux/config
        #SELINUX=enforcing #注释掉
        #SELINUXTYPE=targeted #注释掉
        SELINUX=disabled #增加
        :wq! #保存退出
    `setenforce 0 #使配置立即生效`
    yum install epel-release -y
    yum localinstall --nogpgcheck http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
    yum install ntsysv lrzsz lsof sysstat iotop nohup bzip2-devel openssl-devel

I Install nginx

        yum install nginx#根据提示,输入Y安装即可成功安装或者yum install nginx -y
        systemctl nginx nginx.service #启动nginx
        systemctl stop nginx.service #停止nginx
        systemctl restart nginx.service #重启nginx
        systemctl enable nginx.service #设置nginx开机启动

II Install MariaDB (means MySQL)

        yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成
        systemctl start mariadb.service #启动MariaDB
        systemctl stop mariadb.service #停止MariaDB
        systemctl restart mariadb.service #重启MariaDB
        systemctl enable mariadb.service #设置开机启动

2、Set password for root account
mysql_secure_installation
Press Enter, then press y when prompted
Type the password twice and press enter
Enter y according to the prompt
At last:Thanks for using MySQL!
MariaDB Password setting complete,restart MariaDB:
systemctl restart mariadb.service #重启MariaDB
III Install PHP
1.Install PHP
yum install php #根据提示输入Y直到安装完成
2.Install PH Passembly

        yum install php-fpm php-mysqlnd  php-mbstring php-gd redis php-redis memcached php-memcache php-memcached php-bcmath php-mcrypt
        #这里选择以上安装包进行安装,根据提示输入Y回车
        systemctl restart mariadb.service #重启MariaDB
        systemctl restart nginx.service #重启nginx

Configuration

一、Nginx Configuration

            sed  -i '/fastcgi.conf/'d /etc/nginx/nginx.conf
            sed  -i '/^http {/a\   include fastcgi.conf;'  /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/afastcgi_buffers 8 64k;' /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/afastcgi_buffer_size 64k;' /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/afastcgi_read_timeout 300;' /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/afastcgi_send_timeout 300;' /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/afastcgi_connect_timeout 300;' /etc/nginx/nginx.conf
            sed -i '/    types_hash_max_size 2048;/aclient_max_body_size 20m; ' /etc/nginx/nginx.conf

        systemctl restart nginx.service #重启nginx

二、php Configuration

           sed -i 's/ max_input_vars = 1000/amax_input_vars = 5000' /etc/php.ini
           sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 4M/g' /etc/php.ini
           sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
           sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
        systemctl restart mariadb.service #重启MariaDB
        systemctl restart nginx.service #重启nginx
        service php-fpm restart
        service memcached start

Expansion installation
Needs to install ZendGuardLoader.so

So far, the environment has been configured.

The code of the mall system is divided into two packages,libraries and suteshop。Domain name needs to point to suteshop。


nginx Configuration add a H5 configuration.

location /h5/ {
            try_files $uri $uri/ @router;#需要指向下面的@router否则会出现vue的路由在nginx中刷新出现404
            index  index.html index.htm;
        }
        #对应上面的@router,主要原因是路由的路径资源并不是一个真实的路径,所以无法找到具体的文件
        #因此需要rewrite到index.html中,然后交给路由在处理请求资源
        location @router {
            rewrite ^.*$ /h5/index.html last;
    }

Install:

1、Create a good database first.
2、Type domin name in browser /install. Eg:https://test.suteshop.com/install Follow the instructions to install. Done.

文档更新时间: 2021-02-01 17:47   作者:随商信息技术(上海)有限公司