美文网首页
爱你定操作文档

爱你定操作文档

作者: ArthurIsUsed | 来源:发表于2020-07-15 16:56 被阅读0次

    Install JDK1.8 on server 39.96.20.193 && 39.96.29.113

    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_181
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export PATH=${JAVA_HOME}/bin:$PATH
    
    • source ~/.bashrc

    Install mysql5.7 on server 39.96.29.113

    https://app.yinxiang.com/shard/s15/nl/18441312/c8bd4a19-320c-4447-944d-2eecb631d4a8?title=Install%20mysql5.7%20by%20compiling%20source%20code%20on%20%20Centos

    • 添加用户组: groupadd mysql
    • 添加MySQL用户: useradd -g mysql -s /bin/nologin mysql -M
    • 查看系统中是否安装mysql,如果安装需要卸载.rpm -e –nodeps 命令来卸载掉
      • 输出为空,系统未安装MySQL
    • 安装依赖包: yum -y install wget gcc-c++ ncurses-devel cmake
    • cd /opt/ --- mkdir install_package --- cd install_package/
    • 下载源码包: wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-boost-5.7.20.tar.gz
    • tar xf mysql-boost-5.7.18.tar.gz
    • cd mysql-5.7.18, 运行下面的cmake命令,说明安装路径,编码格式等
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
      -DDEFAULT_CHARSET=utf8 \
      -DDEFAULT_COLLATION=utf8_general_ci \
      -DWITH_MYISAM_STORAGE_ENGINE=1 \
      -DWITH_INNOBASE_STORAGE_ENGINE=1 \
      -DWITH_ARCHIVE_STORAGE_ENGINE=1 \
      -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
      -DWITH_MEMORY_STORAGE_ENGINE=1 \
      -DWITH_READLINE=1 \
      -DENABLED_LOCAL_INFILE=1 \
      -DMYSQL_USER=mysql \
      -DMYSQL_TCP_PORT=3306 \
      -DWITH_BOOST=boost/boost_1_59_0
    
    • 编译安装: make & make install。这个过程会比较久,耐心等候即可
    • 编译完后,MySQL会安装到/usr/local/mysql目录。进入该目录并创建data目录
      • cd /usr/local/mysql
      • mkdir data
      • chown -R mysql. /usr/local/mysql
    • 进入bin目录,初始化数据库
      • cd /usr/local/mysql/bin
      • ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
      • 使用–initialize参数后,一定要记住生成的密码,否则无法登陆数据库。
    [root@backend-cxy ]#cd ./bin
    [root@backend-cxy bin]# ./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
    2017-09-05T15:03:41.067600Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2017-09-05T15:03:41.338120Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2017-09-05T15:03:41.369521Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2017-09-05T15:03:41.426215Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6778cd1c-924b-11e7-a8c2-0050569e3837.
    2017-09-05T15:03:41.426860Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2017-09-05T15:03:41.429970Z 1 [Note] A temporary password is generated for root@localhost: rU?Dow;aA8oF
    
    • 拷贝启动文件到/etc/init.d/下并重命令为mysqld
      • /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    • 将MySQL添加到系统变量中
      • export PATH=$PATH:/usr/local/mysql/bin
    • 将初始化文件复制到/data/目录,修改权限
      • cp -R /usr/local/mysql/data/* /data/
      • chown -R myql. /data
    • 修改配置文件:
      • vim /etc/init.d/mysql---> datadir=/data
      • vim /etc/my.cnf---> datadir=/data
    • 启动服务: /etc/init.d/mysqld start
    • 连接数据库测试: mysql -h localhost -u root -p
    • 初始化root密码:
      • set password = password("NewPassword");
    • 授权root用户使用’NewPassword’从任何机器链接数据库
      • GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'NewPassword' WITH GRANT OPTION;
    • chkconfig mysqld on <---开机启动
    • MySQL5.7去掉ONLY_FULL_GROUP_BY
      • 编辑/etc/my.cnf,在mysqld栏目添加sql_mode="select @@sql_mode"中去点ONLY_FULL_GROUP_BY的字段
      • select @@sql_mode;
      • select @@GLOBAL.sql_mode;
      • /etc/init.d/mysqld restart 重启MySQL

    Install LVM on server 39.96.29.113

    • yum install -y lvm2
    • pvcreate /dev/vdb
    • vgcreate mysql_data /dev/vdb
    • lvcreate -L 99.8G -n mysqldata mysql_data
    • ls /sys/class/scsi_host/---> host0 host1(显示主机总线号)
    echo "- - -" > /sys/class/scsi_host/host0/scan
    echo "- - -" > /sys/class/scsi_host/host1/scan
    
    • cd /
    • mkdir data
    • vim /etc/fstab
    /dev/mysql_data/mysqldata                /data           ext4    defaults              0 0
    
    • mkfs.ext4 /dev/mysql_data/mysqldata
    • mount -a

    备份数据库

    • 查看数据库: show databases;
      • 但是svnadmin和yunzhizaoCompanyDb这2个库都是空库
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | ainidingDB         |
    | ainidingGoodsDB    |
    | ainidingOrderDB    |
    | ainidingPersonDB   |
    | ainidingStoreDB    |
    | dscmall            |
    | mysql              |
    | performance_schema |
    | svnadmin           |
    | sys                |
    | yunzhizaoCompanyDb |
    +--------------------+
    12 rows in set (0.00 sec)
    
    • 查看用户
    mysql> use mysql;
    mysql> select user, host from user;
    +---------------+------------+
    | user          | host       |
    +---------------+------------+
    | root          | %          |
    | tangcong      | %          |
    | root          | %localhost |
    | mysql.session | localhost  |
    | mysql.sys     | localhost  |
    | root          | localhost  |
    +---------------+------------+
    6 rows in set (0.00 sec)
    
    • 记录tangcong用户的权限
    mysql> show grants for tangcong;
    +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Grants for tangcong@%                                                                                                                                                                            |
    +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | GRANT SELECT, INSERT, UPDATE, DELETE, RELOAD, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON *.* TO 'tangcong'@'%'                    |
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `ainidingStoreDB`.* TO 'tangcong'@'%'           |
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingPersonDB`.* TO 'tangcong'@'%' |
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingOrderDB`.* TO 'tangcong'@'%'  |
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingGoodsDB`.* TO 'tangcong'@'%'  |
    | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingDB`.* TO 'tangcong'@'%'       |
    +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    6 rows in set (0.01 sec)
    
    • 备份数据库
      • cd /home
      • mkdir mysql_bakcup
      • cd mysql_bakcup
      • mysqldump -u root -p -R ainidingDB > ainidingDB.2019-01-12.sql
      • mysqldump -u root -p -R ainidingGoodsDB > ainidingGoodsDB.2019-01-12.sql
      • mysqldump -u root -p -R ainidingOrderDB > ainidingOrderDB.2019-01-12.sql
      • mysqldump -u root -p -R ainidingPersonDB > ainidingPersonDB.2019-01-12.sql
      • mysqldump -u root -p -R ainidingStoreDB > ainidingStoreDB.2019-01-12.sql
      • mysqldump -u root -p -R dscmall > dscmall.2019-01-12.sql
      • mysqldump -u root -p -R svnadmin > svnadmin.2019-01-12.sql
      • mysqldump -u root -p -R yunzhizaoCompanyDb > yunzhizaoCompanyDb.2019-01-12.sql
      • cd ../
      • tar -czvf mysql_backup-218-12-13.tar.gz mysql_backup/
    • 上传到远程新的MySQL服务器
      • scp mysql_backup-218-12-13.tar.gz root@39.96.29.113:/home/

    新MySQL服务配置

    • 创建数据库、用户
    create database ainiding_all;
    create database dscmall;
    create database svnadmin;
    create database yunzhizaoCompanyDb;
    create user 'tangcong' identified by 'user_password';
    
    • 导入数据库
    mysql -u root -p ainiding_all < ainidingDB.2019-01-12.sql
    mysql -u root -p ainiding_all < ainidingGoodsDB.2019-01-12.sql
    mysql -u root -p ainiding_all < ainidingOrderDB.2019-01-12.sql
    mysql -u root -p ainiding_all < ainidingPersonDB.2019-01-12.sql
    mysql -u root -p ainiding_all < ainidingStoreDB.2019-01-12.sql
    mysql -u root -p dscmall < dscmall.2019-01-12.sql
    mysql -u root -p svnadmin < svnadmin.2019-01-12.sql
    mysql -u root -p yunzhizaoCompanyDb < yunzhizaoCompanyDb.2019-01-12.sql
    
    • 给tangcong用户授权
    GRANT SELECT, INSERT, UPDATE, DELETE, RELOAD, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON *.* TO 'tangcong'@'%';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, EVENT, TRIGGER ON `ainidingStoreDB`.* TO 'tangcong'@'%';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingPersonDB`.* TO 'tangcong'@'%';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingOrderDB`.* TO 'tangcong'@'%';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingGoodsDB`.* TO 'tangcong'@'%';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, EVENT, TRIGGER ON `ainidingDB`.* TO 'tangcong'@'%';
    flush privileges;
    
    • 在应用服务器上测试数据库端口通
    [root@iz2ze5swka4isry986of3nz jvm]# nc -z -v 172.17.249.238 3306
    Ncat: Version 7.50 ( https://nmap.org/ncat )
    Ncat: Connected to 172.17.249.238:3306.
    Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.
    

    install redis on server 39.96.29.113

    • wget http://download.redis.io/releases/redis-4.0.10.tar.gz
    • tar xzf redis-4.0.10.tar.gz
    • mv redis-4.0.10 /usr/local/
    • cd /usr/local/redis-4.0.10/
    • make
    • vim redis.conf --->
      • bind 172.17.249.238 让应用服务可以访问redis
      • requirepass pn9l!@A)n8YX 设置密码
    • src/redis-server &
    [root@iz2zedgf358qnu5zp9jv4iz src]# ps -ef | grep redis
    root     10133  6779  0 09:19 pts/1    00:00:00 ./redis-server *:6379
    root     10138  6779  0 09:19 pts/1    00:00:00 grep --color=auto redis
    

    install tomcat on server 39.96.20.193

    查看老的应用服务器有哪几个tomcat在跑

    • cd /usr/azpath
    • ll | grep tomcat
    • ps -ef | grep tomcat, 查看有哪几个tomcat在运行
    [root@izwz90dk2jeypggsjii2xmz conf]# ll /usr/azpath/ | grep tomcat
    drwxr-xr-x  4 root root       4096 May  2  2018 dubbo-admin-tomcat
    drwxr-xr-x  9 root root       4096 Oct 10  2017 hudson-tomcat
    drwxr-xr-x  9 root root       4096 Oct 10  2017 sonarqube-tomcat
    drwxr-xr-x  9 root root       4096 Jul 21 15:30 svnadmin-tomcat
    drwxr-xr-x 10 root root       4096 Dec 13 18:10 web-tomcat
    
    Project Status
    dubbo-admin-tomcat Running
    husdon-tomcat Running
    sonarqube-tomcat Sleep
    svnadmin-tomcat Running
    web-tomcat Running

    新服务不用tomcat,排查为何页面卡

    • vmstat 显示CPU、内存都很正常,si/so都为零,且free还有6G可用,CPU空闲99%


    • iostat -x -m 5 10查看,此时能正常访问

      • avgrq-sz这个值反应了用户的IO-Pattern。我们经常关心,用户过来的IO是大IO还是小IO,那么avgrq-sz反应了这个要素。它的含义是说,平均下来,这这段时间内,所有请求的平均大小,单位是扇区,
      • avgqu-sz平均队列长度短,正常
      • svctm,平均服务时长百分比很低
      • wait这一栏数值比较高
      • w_wait,写等待高的时候20。*_wait小于5ms是正常的,高于10都是表明系统存在问题。
      • 综合这几组数据表明,就绪队列很长,都在排队,等着把CPU处理完的数据写入磁盘,但是需要写的太多了,w_wait时间达到20ms
      • 结合现有服务的情况,此服务器CPU8核,内存16G,足够。但是有5个tomcat、dubbo、maven、 nexus、MySQL、redis都在跑,而且只有一块磁盘,所以存在IO瓶颈。
      • 由于多个程序都等待写入磁盘后,CPU返回结果给client端,但是w_wait高,让用户感觉到访问页面卡顿,或者慢,甚至请求不到数据提示:网络请求超时,请稍后再试。


    39.96.29.113服务器安装zookeeper

    dataDir=/opt/zookeeper-3.4.13/data
    dataLogDir=/opt/zookeeper-3.4.13/logs
    
    • 修改日志目录
      • vim conf/log4j.properties,修改两个日志目录,改成当前的logs目录
      • zookeeper.log.dir=./logs
      • zookeeper.tracelog.dir=./logs
    • 启动zookeeper
    [root@iz2ze5swka4isry986of3nz conf]# vim zoo.cfg 
    [root@iz2ze5swka4isry986of3nz conf]# ../bin/zkServer.sh start
    ZooKeeper JMX enabled by default
    Using config: /opt/zookeeper-3.4.13/bin/../conf/zoo.cfg
    Starting zookeeper ... STARTED
    
    [root@iz2ze5swka4isry986of3nz zookeeper-3.4.13]# netstat -anpt | grep 2181
    tcp        0      0 0.0.0.0:2181            0.0.0.0:*               LISTEN      15734/java 
    

    39.96.29.113服务器安装tomcat,启动dubbo-admin

    [root@iz2ze5swka4isry986of3nz dubbo-admin]#  mvn package -Dmaven.test.skip=true 
    -bash: mvn: command not found
    
    [root@iz2ze5swka4isry986of3nz bin]# mvn -v
    Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-25T02:41:47+08:00)
    Maven home: /opt/apache-maven-3.6.0
    Java version: 1.8.0_191, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk1.8.0_191/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "linux", version: "3.10.0-693.2.2.el7.x86_64", arch: "amd64", family: "unix"
    
    • 再次对dubbo-admin项目打包
      • cd /opt/install_package/incubator-dubbo-dubbo-2.5.4/dubbo-admin/
      • mvn package -Dmaven.test.skip=true
      • vim pom.xml,将${project.parent.version}改成2.5.3,重新打包
    [ERROR] Failed to execute goal on project dubbo-admin: Could not resolve dependencies for project com.alibaba:dubbo-admin:war:2.5.4-SNAPSHOT: Could not find artifact com.alibaba:dubbo:jar:2.5.4-SNAPSHOT -> [Help 1]
    [root@iz2ze5swka4isry986of3nz dubbo-admin]# vim pom.xml 
    ---------------修改前----------------------
    <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>dubbo</artifactId>
       <version>${project.parent.version}</version>
      </dependency>
    ---------------修改后----------------------
    <dependency>
       <groupId>com.alibaba</groupId>
       <artifactId>dubbo</artifactId>
       <version>2.5.3</version>
      </dependency>
    
    • 打包成功的提示如下:
    [INFO] Building war: /opt/install_package/incubator-dubbo-dubbo-2.5.4/dubbo-admin/target/dubbo-admin-2.5.4-SNAPSHOT.war
    [INFO] WEB-INF/web.xml already added, skipping
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  03:18 min
    [INFO] Finished at: 2019-01-04T14:28:13+08:00
    [INFO] ------------------------------------------------------------------------
    
    • 将dubbo-admin的war包放到tomcat的webapps目录下
      • cd target
      • cp dubbo-admin-2.5.4-SNAPSHOT.war /opt/tomcat_dubboadmin/webapps/
      • cd /opt/tomcat_dubboadmin/bin
      • ./startup.sh 查看端口是否起来
    [root@iz2ze5swka4isry986of3nz bin]# netstat -anpt | grep 80
    tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      27655/java          
    tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN      27655/java          
    tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN      27655/java 
    

    install Rap

    • 下载RAP的war包
    • unzip -x RAP-0.14.0-SNAPSHOT.war -d /usr/local/apache-tomcat-8.0.24/webapps/ROOT
    • 修改/opt/tomcat_Rap/webapps/ROOT/WEB-INF/classes/config.properties
    • MySQL中创建rap_db的数据库、创建rap的用户
    • 初始化数据库, mysql -u rap -p rap_db < classes/dabatase/initialize.sql
    • 启动tomcat,设置nginx转发

    应用服务器上跑ainiding_manage程序

    • cd /opt/
    • makdir ainiding_manage
    • cd ainiding_manage/ 将jar, war包传入此目录
    • 运行程序
      • java -jar ainiding-manage-service.jar &
      • java -jar ainiding-manage-web.jar &
    • 检查程序是否正常启动
    [root@iz2ze5swka4isry986of3nz ainiding_manage]# netstat -anpt
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:8085            0.0.0.0:*               LISTEN      13218/java          
    tcp        0      0 0.0.0.0:8086            0.0.0.0:*               LISTEN      13873/java 
    

    各个服务对应的端口

    Servier Nmae Port
    ainiding-phone-api 8087
    ainiding-phone-service 8088
    ainiding-phone-wx 8089
    ainiding-manage-service 8085
    ainiding-manage-web 8086
    ainiding-store-api 8081
    ainiding-store-service 8084
    • 运行各个jar包, jar -jar package_name.jar &
      • 查看启动状态
    [root@iz2ze5swka4isry986of3nz ainiding_phone]# ps -ef | grep ainiding
    root      3904 13067  6 18:43 pts/0    00:01:03 java -jar ainiding-manage-web.war
    root      3947 13273  4 18:44 pts/1    00:00:38 java -jar ainiding-manage-service.jar
    root      4018 13067  3 18:45 pts/0    00:00:27 java -jar ainiding-store-api.jar
    root      4143 13273  4 18:45 pts/1    00:00:37 java -jar ainiding-store-service.jar
    root      4497 13273 50 18:58 pts/1    00:00:29 java -jar ainiding-phone-api.jar
    root      4541 13067 88 18:58 pts/0    00:00:33 java -jar ainiding-phone-service.jar
    root      4594 13273 99 18:59 pts/1    00:00:33 java -jar ainiding-phone-wx.war
    
    [root@iz2ze5swka4isry986of3nz ainiding_phone]# ps -ef | grep ainiding
    root      3904 13067  6 18:43 pts/0    00:01:03 java -jar ainiding-manage-web.war
    root      3947 13273  4 18:44 pts/1    00:00:38 java -jar ainiding-manage-service.jar
    root      4018 13067  3 18:45 pts/0    00:00:27 java -jar ainiding-store-api.jar
    root      4143 13273  4 18:45 pts/1    00:00:37 java -jar ainiding-store-service.jar
    root      4497 13273 50 18:58 pts/1    00:00:29 java -jar ainiding-phone-api.jar
    root      4541 13067 88 18:58 pts/0    00:00:33 java -jar ainiding-phone-service.jar
    root      4594 13273 99 18:59 pts/1    00:00:33 java -jar ainiding-phone-wx.war
    

    应用服务器安装nginx

    yum install -y gcc gcc-c++
    yum install -y bzip2 bzip2-devel
    yum install -y zlib zlib-devel
    yum install -y readline readline-devel
    ./configure --prefix=/usr                     \
                --docdir=/usr/share/doc/pcre-8.42 \
                --enable-unicode-properties       \
                --enable-pcre16                   \
                --enable-pcre32                   \
                --enable-pcregrep-libz            \
                --enable-pcregrep-libbz2          \
                --enable-pcretest-libreadline     \
                --disable-static                 &&
    make
    
    make install                     &&
    mv -v /usr/lib/libpcre.so.* /lib &&
    ln -sfv ../../lib/$(readlink /usr/lib/libpcre.so) /usr/lib/libpcre.so
    
    ./configure  --prefix=/usr/local/nginx  --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/var/log/nginx/error.log  --http-log-path=/var/log/nginx/access.log  --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock  --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
    
    make && make install 
    
    • vim /usr/local/nginx/conf/nginx.conf
            server_name  store.ainiding.com;
            location / {
               proxy_pass http://127.0.0.1:8086;
               proxy_set_header Host $host;
               proxy_set_header X-Forwarded-For $remote_addr;
            }
    
    • useradd -s /sbin/nologin -M nginx

    • cd /var/tmp/

    • mkdir nginx
      -cd nginx

    • mkdir client

    • cd /usr/local/nginx/sbin

    • ./nginx -t 检查语法是否有错误,提示成功就 ./nginx直接启动

    • nginx部署SSL证书,并自动跳转

            listen       443;
            listen       80;
            server_name  store.ainiding.com;
            ssl                  on;
            ssl_certificate      /root/andcrt/1560528__ainiding.com.crt;
            ssl_certificate_key  /root/andcrt/1560528__ainiding.com.key;
            error_page 497  https://$host$uri?$args;
            ssl_session_timeout 5m;
            ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            ssl_prefer_server_ciphers on;
    

    更新域名解析

    • 登录阿里云后台,找到域名解析
      • store.mobile.api--> 120.78.95.11换成39.96.20.193
      • store--> 120.78.95.11换成39.96.20.193
      • weixin--> 120.78.95.11换成39.96.20.193
      • mobile.person.api--> 120.78.95.11换成39.96.20.193

    相关文章

      网友评论

          本文标题:爱你定操作文档

          本文链接:https://www.haomeiwen.com/subject/wzrjhktx.html