centos7 命令记录

1 篇文章 0 订阅
1 篇文章 0 订阅

为什么写这篇文章?
最近在学习UBUNTU系统,这篇文章是简单记录一下所学习的内容及遇到的问题,在学完后可以快速回顾。
文章作用:温故;

CENTOS7.4安装 LAMP

APACHE(httpd)

  • 安装:yum install httpd
  • 检测(启动):systemctl start httpd.service
  • 可在浏览器中输入本机IP访问
  • 设置开机启动:systemctl enable httpd.service //开启:enable;关闭:disable;检测状态:is-enabled;

mariadb

  • 安装:yum install mariadb‐server mariadb
  • 检测:systemctl start mariadb.service
  • 设置开机启动:systemctl enable mariadb.service
  • 修改mysql登录密码:SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass'); //mysql不区分大小写

php5.4

  • 安装插件:yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
    // php-mysql 必须要安装
  • 检测:新建一个index.php,打印phpinfo()函数
  • 无需启动

安装包命令

  • 安装:yum install httpd
  • 查询是否已经安装httpd:yum list installed|grep httpd
  • 查询所有已经安装的包:rpm -qa|grep httpd
  • 擦除已安装的包 rpm -e httpd-2.4.6-67.el7.centos.6.x86_64
  • 查询可以安装的包 ?
  • 公钥对应md5码:openssl x509 -noout -modulus -in gongyao.crt| openssl md5
  • 私钥对应md5码:openssl rsa -noout -modulus -in private.key | openssl md5
  • 两码结果需要对应

  • 查看某域名公钥(证书):openssl s_client -connect jgm.wdianc.com:443

配置多个HTTPS

1.申请证书

  • 为什么要申请?
    浏览器需要安装证书以后才能够通过https访问到网站。证书可由opssl命令生成。而由某些CA机构颂发的证书,浏览器能够直接信任,避免安全提示(安全提示需要手动选择是否信任,严重影响客户体验,另外,在手机端会直接导致某https请求无法响应导致的页面空白)。
  • 证书申请方法
    阿里云(推荐)
    腾讯云
    七牛云

2.在/etc/httpd/conf.d/ssl.conf 文件中打开以下注释(必须开启此文件的ssl功能)

#开启SSL引擎
SSLEngine on
#配置公钥(证书)
SSLCertificateFile /etc/httpd/ssl_certification/zhengshu.crt
#配置私钥
SSLCertificateKeyFile /etc/httpd/ssl_certification/siyao.key

3.在/etc/httpd/vhost.d/baidu.conf 文件中配置对应的公钥和私钥

<VirtualHost *:443>
  ServerName baidu.com:443
  DocumentRoot "/var/www/baidu"
  #配置公钥(证书)
  SSLCertificateFile /etc/httpd/ssl_certification/baidu_trustAsia/baidu.com.crt
  #配置私钥
  SSLCertificateKeyFile /etc/httpd/ssl_certification/baidu_trustAsia/baidu.com.key
</VirtualHost>
<Directory /var/www/baidu>
  AllowOverride None
  Options None
  Require all granted
</Directory>

4.重启httpd,测试

systemctl restart httpd.service
然后使用浏览器访问https://baidu.com
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值