动静分离

动静分离

[root@promote ~]# yum install httpd httpd-devel -y
[root@promote ~]# firewall-cmd --permanent --zone=public --add-service=http  防火墙放开http的许可
success
[root@promote ~]# firewall-cmd --permanent --zone=public --add-service=https  防火墙放开https的许可

success
[root@promote ~]# firewall-cmd --reload     ##重新加载防火墙
success
[root@promote ~]# systemctl start httpd.service 

在这里插入图片描述

[root@promote ~]# yum install mariadb mariadb-server mariadb-libs mariadb-devel -y
[root@promote ~]# systemctl start mariadb
[root@promote ~]# netstat -ntap | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      8926/mysqld  
 [root@promote ~]# mysql_secure_installation 

在这里插入图片描述

[root@promote ~]# yum install php -y
[root@promote ~]# yum install php-mysql -y
[root@promote ~]# yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath   ##php各种解析 插件
[root@promote ~]# cd /var/www/html/
[root@promote html]# ls
[root@promote html]# vim index.php

在这里插入图片描述

[root@promote html]# systemctl restart httpd.service 

在这里插入图片描述

---------------------------------接下来换个虚拟机做nginx-----------------------------------------------

[root@nginx ~]# cd /opt
[root@nginx opt]# rz -E
rz waiting to receive.
[root@nginx opt]# ls
nginx-1.12.2.tar.gz  rh
[root@nginx opt]# tar zxvf nginx-1.12.2.tar.gz 
[root@nginx nginx-1.12.2]# useradd -M -s /sbin/nologin nginx   创建程序用户
[root@nginx nginx-1.12.2]# yum install pcre-devel zlib-devel gcc gcc-c++ -y
[root@nginx nginx-1.12.2]# ./configure \
> --prefix=/usr/local/nginx \
> --user=nginx \
> --group=nginx \
> --with-http_stub_status_module
[root@nginx nginx-1.12.2]# make && make install
[root@nginx nginx-1.12.2]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
[root@nginx nginx-1.12.2]# vim /etc/init.d/nginx
#!/bin/bash
#chkconfig: - 99 20
#description Nginx Service Control Script
PROG="/usr/local/nginx/sbin/nginx"
PIDF="/usr/local/nginx/logs/nginx.pid"
case "$1" in
  start)
        $PROG
        ;;
  stop)
        kill -s QUIT $(cat $PIDF)
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  reload)
        kill -s HUP $(cat $PIDF)
        ;;
  *)
             echo "Usage: $0 {start|stop|restart|reload}"
             exit 1
esac
exit 0

在这里插入图片描述

[root@nginx nginx-1.12.2]# chmod +x /etc/init.d/nginx 
[root@nginx nginx-1.12.2]# chkconfig --add nginx
[root@nginx nginx-1.12.2]# yum install elinks -y    安装一个网页验证
[root@nginx nginx-1.12.2]# service nginx start
[root@nginx nginx-1.12.2]# netstat -ntap | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      14973/nginx: master 
[root@nginx nginx-1.12.2]# systemctl stop firewalld.service 
[root@nginx nginx-1.12.2]# setenforce 0
[root@nginx nginx-1.12.2]# elinks http://192.168.169.250

在这里插入图片描述
在这里插入图片描述

[root@nginx nginx-1.12.2]# vim /usr/local/nginx/conf/nginx.conf

在这里插入图片描述

[root@nginx nginx-1.12.2]# service nginx stop
[root@nginx nginx-1.12.2]# service nginx start

在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值