搭建环境
- centos-7.8
- mysql-5.6.51
- php-7.1.33
- nginx-1.12.2
- Fecmall-2.17.4
初始化
echo "ulimit -SHn 65535" >> /etc/rc.local
cat >> /etc/security/limits.conf << EOF
* soft nofile 65535
* hard nofile 65535
EOF
sed -i 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config
setenforce 0
echo 20 > /proc/sys/vm/swappiness
echo 102400 > /proc/sys/kernel/pid_max
yum groupinstall -y "Base" "Development tools"
yum install -y gcc-c++ libffi-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libconv-devel freetype-devel libpng-devel mysql-libs mysql-devel ncurses-devel libcurl-devel libxslt-devel cmake bind-utils git epel-release screen sysstat numactl dhclient tree telnet dos2unix lrzsz nc vim gcc pcre pcre-devel subversion ntp openssl openssl-devel zlib-devel gd-devel
yum install -y epel-release
mysql搭建
- 二进制安装mysql5.6
yum -y install gcc gcc-c++ autoconf automake make zlib zlib-devel openssl openssl-devel pcre pcre-devel wget useradd mysql -s /sbin/nologin -M mkdir -p /data/mysqldb/ cd /tmp && wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz tar zxf mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz mv mysql-5.6.51-linux-glibc2.12-x86_64 /usr/local/mysql chown -R mysql.mysql /usr/local/mysql chown -R mysql.mysql /data/mysqldb cd /usr/local/mysql/scripts/ ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysqldb ln -s /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
- 配置my.cnf
cat > /etc/my.cnf << EOF [client] port = 3306 [mysqld] user = mysql port = 3306 basedir = /usr/local/mysql character-set-server=utf8 datadir = /data/mysqldb open_files_limit = 10240 log-bin=mysql-bin binlog_format = MIXED back_log = 600 max_connections = 2000 max_connect_errors = 6000 external-locking = FALSE max_allowed_packet = 32M thread_cache_size = 300 query_cache_size = 0M query_cache_limit = 4M query_cache_min_res_unit = 2k tmp_table_size = 256M max_heap_table_size = 256M expire_logs_days = 7 key_buffer_size = 32M read_buffer_size = 1M read_rnd_buffer_size = 16M bulk_insert_buffer_size = 64M myisam_sort_buffer_size = 128M myisam_max_sort_file_size = 10G myisam_recover_options = DEFAULT skip-name-resolve lower_case_table_names = 1 server-id = 1 innodb_buffer_pool_size = 512M innodb_thread_concurrency = 8 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 8M innodb_lock_wait_timeout = 120 innodb_file_per_table = 1 [mysqldump] quick [mysqld_safe] sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES EOF
- 启动mysql并且设置密码
/etc/init.d/mysqld start /usr/local/mysql/bin/mysqladmin -u root password '123456' echo 'export PATH="$PATH:/usr/local/mysql/bin"' >> /etc/profile source /etc/profile
php搭建
yum install -y libxml2-devel openssl-devel curl-devel libjpeg-turbo-devel libpng-devel gd freetype-devel libicu-devel gcc-c++ autoconf zlib-devel autoconf libmemcached-devel mariadb-devel ImageMagick-devel libsqlite*
mkdir /data/soft -p
cd /tmp
wget https://www.php.net/distributions/php-7.1.33.tar.gz
tar xf php-7.1.33.tar.gz
cd php-7.1.33
./configure --prefix=/data/soft/php7 --enable-fpm --sysconfdir=/data/soft/php7/etc/ --with-config-file-path=/data/soft/php7/etc/ --enable-shared --enable-bcmath --with-gettext --with-bz2 --with-libxml-dir --with-gd --with-openssl --enable-mbstring --with-mysqli=mysqlnd --enable-mysqlnd --enable-zip --enable-intl --with-zlib-dir --with-pdo-mysql=mysqlnd --with-jpeg-dir --with-freetype-dir --with-curl --with-pdo-sqlite --with-sqlite3 --enable-soap --enable-pcntl
make
make install
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
mv /data/soft/php7/lib/php.ini-development /data/soft/php7/lib/php.ini
cp /data/soft/php7/etc/php-fpm.conf.default /data/soft/php7/etc/php-fpm.conf
cp /data/soft/php7/etc/php-fpm.d/www.conf.default /data/soft/php7/etc/php-fpm.d/www.conf
/etc/init.d/php-fpm start
ln -s /data/soft/php7/bin/php /usr/local/bin/php
nginx安装
- 安装nginx
useradd www -s /sbin/nologin -M yum install wget gcc openssl gcc-c++ autoconf automake make zlib zlib-devel openssl-devel pcre pcre-devel -y wget http://nginx.org/download/nginx-1.12.2.tar.gz tar -xf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module make && make install mkdir /usr/local/nginx/conf.d -p mkdir /usr/local/nginx/cert -p
-
配置nginx
cat > /usr/local/nginx/conf/nginx.conf << EOF user www; worker_processes 2; worker_cpu_affinity 0001 0010; #error_log logs/error.log; error_log /dev/null; pid logs/nginx.pid; worker_rlimit_nofile 65535; events { use epoll; worker_connections 65535; } http { map $http_upgrade $connection_upgrade { default upgrade; '' close; } include mime.types; default_type application/octet-stream; access_log off; log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; sendfile on; tcp_nopush on; keepalive_timeout 65; #keepalive_timeout 1800; #keepalive_requests 500; client_header_timeout 15; client_body_timeout 60; send_timeout 60; client_max_body_size 20m; server_tokens off; gzip on; gzip_min_length 2k; gzip_buffers 4 32k; gzip_http_version 1.1; gzip_comp_level 2; gzip_types text/plain application/json application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php; include ../conf.d/*.conf; } EOF
- 配置www.test007.com测试域名
cat > /usr/local/nginx/conf.d/www.test007.com.conf << EOF server { listen 80; server_name www.test007.com; root /data/www/fecmall/appfront/web; server_tokens off; index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location ~ .php/ { ## Forward paths like //cfwww.d8wz.com/js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location /fr/ { index index.php; if (!-e $request_filename){ rewrite . /fr/index.php last; } } location /cn/ { index index.php; if (!-e $request_filename){ rewrite . /cn/index.php last; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } server { listen 80 ; server_name m.test007.com; root /data/www/fecmall/apphtml5/web; server_tokens off; index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location ~ .php/ { ## Forward paths like //cfwww.d8wz.com/js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location /fr/ { index index.php; if (!-e $request_filename){ rewrite . /fr/index.php last; } } location /cn/ { index index.php; if (!-e $request_filename){ rewrite . /cn/index.php last; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } server { listen 80 ; server_name img.test007.com; root /data/www/fecmall/appimage/common; server_tokens off; location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } } server { listen 80 ; server_name appserver.test007.com; root /data/www/fecmall/appserver/web; server_tokens off; index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location ~ .php/ { ## Forward paths like //cfwww.d8wz.com/js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } server { listen 80 ; server_name appadmin.test007.com; root /data/www/fecmall/appadmin/web; server_tokens off; index index.php index.html index.htm; location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location ~ .php/ { ## Forward paths like //cfwww.d8wz.com/js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } server { listen 80 ; server_name appapi.test007.com; root /data/www/fecmall/appapi/web; server_tokens off; index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; } location ~ .php/ { ## Forward paths like //cfwww.d8wz.com/js/index.php/x.js to relevant handler rewrite ^(.*.php)/ $1 last; } location / { if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } } EOF
Fecmall安装
-
下载Fecmall
cd /data/www/fecmall wget https://fecmall-download.oss-cn-shenzhen.aliyuncs.com/download/fecmall-lasted.zip unzip fecmall-lasted.zip chown www.www /data/www/ -R chmod 755 /data/www/fecmall/ -R
-
初始化init
cd /data/www/fecmall ./init
-
创建数据库
mysql -uroot -p123456 -hlocalhost >> create database fecmall
-
启动nginx
/usr/local/nginx/sbin/nginx -t /usr/local/nginx/sbin/nginx
-
本地电脑hosts解析
-
C:\Windows\System32\drivers\etc\hosts
服务器ip www.test007.com 服务器ip appadmin.test007.com 服务器ip img.test007.com 服务器ip m.test007.com 服务器ip appserver.test007.com 服务器ip appapi.test007.com
-
进入web界面安装
http://www.test007.com/install/ 安提示配置,mysql信息在上面,127.0.0.1改为localhost
-
登录后台
http://appadmin.test007.com/ ##如果不想别人知道,可以改你仅自己知道的域名
相关文章
暂无评论...