• Linux 搭建nginx redis mysql rabbitmq以及配置SSL


    搭建nginx

    压缩包自行下载,这里是nginx-1.20.2.tar.gz

    1.上传压缩包到/opt/software 目录下

    2.安装nginx依赖
    yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

    3.解压nginx
    cd /opt/software
    tar -zxf nginx-1.20.2.tar.gz

    4.进入nginx文件夹
    cd nginx-1.20.2/

    5.配置nginx
    ./configure --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module

    6.编译并安装
    make
    make install

    7.启动nginx
    /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf

    搭建redis

    这里是redis-5.0.14.tar.gz

    1.解压
    cd /opt/software
    tar -zxf redis-5.0.14.tar.gz

    2.编译安装
    cd redis-5.0.14/
    make
    make install PREFIX=/opt/redis

    3.配置文件详见redis.conf
    配置文件可修改端口,密码,以及开启守护线程(开启守护线程daemonize 改为yes,修改ip:bing 127.0.0.1,requirepass 123456)

    4.启动redis
    /opt/redis/bin/redis-server /opt/software/redis-5.0.14/redis.conf

    搭建mysql

    1.进入/opt/software下载rpm(这里也可以下载tar压缩包上传上去,解压后效果也一样)
    wget \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-client-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-common-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-compat-5.7.32-1.el7.x86_64.rpm \ https://cdn.mysql.com/archives/mysql-5.7/mysql-community-server-5.7.32-1.el7.x86_64.rpm

    2.安装rpm
    yum install -y mysql-community-*-5.7.32-1.el7.x86_64.rpm

    3.启动mysql:
    systemctl start mysqld

    4.查看默认生成的密码:
    cat /var/log/mysqld.log | grep password

    5.登录mysql(p后面接你的密码)
    mysql -uroot -p

    6.设置新密码(当前@'localhost’配置,只有本地ip可连接)
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Lutu6688@';
    flush privileges;

    7.修改mysql配置:
    退出mysql
    exit
    vim /etc/my.cnf
    下图为修改后的配置文件截图
    在这里插入图片描述
    8.重启mysql
    systemctl restart mysqld

    搭建rabbitmq

    上传rabbitmq至/usr/local/src/software/rabbitMQ/

    1.安装Erlang依赖包
    cd /usr/local/src/software/rabbitMQ/
    查看安装包信息
    ls -l
    执行安装Erlang依赖包:rpm -ivh erlang-22.0.7-1.el7.x86_64.rpm
    rpm -ivh erlang-22.0.7-1.el7.x86_64.rpm
    执行安装Erlang内存管理的依赖包:rpm -ivh socat-1.7.3.2-2.el7.x86_64.rpm
    rpm -ivh socat-1.7.3.2-2.el7.x86_64.rpm
    安装RabbitMQ安装包(需要联网)
    rpm -ivh rabbitmq-server-3.7.18-1.el7.noarch.rpm

    2.复制配置文件
    cp /usr/share/doc/rabbitmq-server-3.7.18/rabbitmq.config.example /etc/rabbitmq/rabbitmq.config

    3.修改配置文件
    vim /etc/rabbitmq/rabbitmq.config
    开放来宾账户权限loopback_users:把注释开放,注意尾部的逗号也去掉:

    注意!注意!此处只做记录,搭建rabbitmq并非原创引用(下面地址为引用地址更加详细):

    https://csp1999.blog.csdn.net/article/details/111315851?spm=1001.2014.3001.5506

    如果要用rabbitmq的延时队列还需要延时队列插件安装(后续补充)

    nginx配置域名及SSL

    hushixiaolu.com为域名, /etc/nginx/cert/hushixiaolu.pem,/etc/nginx/cert/hushixiaolu.key为ssl证书密钥

    server {
    #ssl参数
    listen 443;
    server_name hushixiaolu.com;
    ssl on;
    root /web;
    index index.html index.htm;
    #证书文件
    ssl_certificate /etc/nginx/cert/hushixiaolu.pem;
    ssl_certificate_key /etc/nginx/cert/hushixiaolu.key;
    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;
    location / {
    root /web;
    try_files $uri $uri/ /index.html;
    index index.html index.htm;
    }
    }

  • 相关阅读:
    [柏鹭杯 2021]baby_python
    【虚拟机开不了】linux、centOS虚拟机出现entering emergency mode解决方案
    Unity数据加密☀️ 三、加密DLL供Unity使用
    好心情:这4种营养素能增强抗抑郁药的疗效!不知道的人亏大了
    01-juc-入门概念
    Golang学习日志 ━━ Gin-Vue-Admin按步骤手动创建api及router、service
    Qt 5.12.12 静态编译(MinGW)
    Java常用类和对象---尚硅谷Java入门视频学习
    【AD】【操作】怎么只选择走线和过孔?(或者是自己选择 要选中的类型)
    NLP自然语言处理(二)
  • 原文地址:https://blog.csdn.net/Yourisa/article/details/126619354