动静分离
[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