lnmp电商项目

--- LNMP企业级架构
什么是lnmp linux + linux + nginx + php

服务器准备 centos7.6

修改主机名 hostnamectl set-hostname lnmp.itcast.cn vim /etc/hosts 10.1.1.10 lnmp lnmp.itcast.cn

更改网卡ip地址与UUID编号 ipaddr = 10.1.1.10 UUID 更改编号的最后3位 systemctl restart network

关闭防火墙与selinux systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i '/SELINUX=enforcing/cSELINUX=disabled' /etc/selinux/config

关闭networkmanager服务 systemctl stop NetworkManager systemctl disable NetworkManager

配置yum 源 rpm -ivh epel-release-latest-7.noarch.rpm cat server.repo

安装ntpdate,进行同步时间 yum install ntpdate -y ntpdate cn.ntp.org.cn

---- lnmp 软件构构之 myaql 企业级数据库部署中,常用两种安装方式:GLIBC安装和源码安装

使用glibc安装mysql 默认安装路径: /usr/local/mysql -mysql 安装目录 /usr/local/mysql/data -mysql数据目录 :3306 -端口 /tmp/mysql.sock -套接字文件,负责客户端与服务器端进行通信

glibc安装步骤 上传mysql 压缩包到服务器 mysql....tar.gz 编写mysql.sh脚本、 vim mysql.sh

#!/bin/bash tar -zxf mysql....tar.gz mv mysql... /usr/local/mysql useradd -r -s /sbin/nologin mysql chown -R mysql.mysql /usr/local/mysql cd /usr/local/mysql yum remove mariadb-libs -y scripts/mysql_install_db --user=mysql cp support-files/mysql.server /etc/init.d/mysql service mysql start echo 'export PATH=$PATH:/usr/local/mysql/mysql/bin' >> /etc/profile source /etc/profile :wq source mysql.sh

---mysql 后续配置 配置mysql密码及安全策略 mysql_secure_installation -按提示设置密码和策略

mysql 测试验证 本地登录 mysql -uroot -p

远程登录 mysql -h ip -p port -uroot -p

---- nginx curl -I 域名 -查看网站是否使用nginx,server: xxx

nginx特点 可用作http服务器,邮件,代理服务器,实现负载均衡 热部署 高并发 响应快 消耗低 分布式支持

ngin 安装 yum安装 -版本低,无法定制 源码编译 -官网下载安装包stable 稳定版

编写shell脚本安装nginx软件(配置-编译-安装) vi nginx.sh

#!/bin/bash tar -zxf nginx-1.12.2.tar.gz cd nginx-1.12.2 useradd -r -s /sbin/nologin www ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module make && make-install

注: --prefix -安装路径 --user -以哪个用户安装初始化 --group -以哪个组 --with-* -代表安装哪些模块

cd /usr/local/nginx/ ls conf -配置 html -网站目录 logs -日志 sbin -运行程序

nginx启动

创建nginx.service脚本 vim /usr/lob/systemd/system/nginx.service

#!/bin/bash [Unit] Description=Nginx Wweb Server Ater=network.target

[Sservice] Type=forking ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/ngin/conf/nginx.conf ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s quit privateTmp=true

[install WantedBy=multi-user.target :wq

注: Type=forking -代表后台运行

使用用脚本nginx.service 开启/重启/关闭 systemctl start/restart/stop nginx.service

---- lnmp 之 php-fpm php-fpm安装 安装依赖库存 yum -y install libxm12-devel li.....

编写配置文件 vim tar -zxf php-7.2.12.tar.gz cd php7.2.12 ./configure --prefix=/usr/local/php --with-config-file- path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www - -with-mysql=mysqlnd --with-pdo-mysql=mysqlnd make && make install

注: --perfix -安装目录 --with-config-file-path 配置文件目录 --enable-fpm -开启php-fpm功能 --with-fpm-user -以哪个用户 --with-fpm-group -以哪个组 --with-mysqli -php-fpm扩展 --with-pdo-mysql -pdo扩展

JS
JSRUN前端笔记, 是针对前端工程师开放的一个笔记分享平台,是前端工程师记录重点、分享经验的一个笔记本。JSRUN前端采用的 MarkDown 语法 (极客专用语法), 这里属于IT工程师。