LAMP = Linux + Apache + MySQL + PHP
Apache:主要用于接收用户的请求,处理业务逻辑,返回结果给客户端(浏览器)
PHP:编程语言的一种,主要应用于Web开发。主要实现软件的各种功能
MySQL:数据库,永久保存数据
扩展:
LNMP:Linux + Nginx + MySQL + php-fpm
LNMPA:Linux + Nginx(80) + MySQL + PHP + Apache
[root@server1 ~]# setenforce 0
[root@server1 ~]# getenforce
Permissive
[root@server1 ~]# firewall-cmd --add-port=80/tcp --permanent
success
[root@server1 ~]# firewall-cmd --reload
success
[root@server1 ~]# yum install -y httpd wget
[root@server1 ~]# systemctl start httpd.service
[root@server1 ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@server1 ~]# yum install -y php-* --skip-broken php-mysqlnd
[root@server1 html]# wget http://mirrrors.eagleslab.com:8889/tz.php <--探针
[root@server1 html]# systemctl restart httpd.service
浏览器访问探针:192.168.226.10/tz.php
说明PHP运行正常
[root@server1 html]# yum install -y mariadb mariadb-server
[root@server1 html]# systemctl start mariadb.service
[root@server1 html]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@server1 html]# mysql_secure_installation
#初始化,设置密码即可,其他回车
测试PHP是否成功连接mysql
说明php成功连接mysql
[root@server1 html]# mysql -uroot -p1 -e"create database blog;show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| blog |
| mysql |
| performance_schema |
+--------------------+
浏览器-->typecho官网-->立即下载-->复制“下载正式版”链接地址
[root@server1 html]# wget http://typecho.org/downloads/1.1-17.10.30-release.tar.gz
[root@server1 html]# ls
1.1-17.10.30-release.tar.gz tz.php
[root@server1 html]# tar -zxf 1.1-17.10.30-release.tar.gz
[root@server1 html]# ls
1.1-17.10.30-release.tar.gz build tz.php
#build为解压后的文件
[root@server1 html]# cp -r build/* .
[root@server1 html]# ls
1.1-17.10.30-release.tar.gz admin build index.php install install.php LICENSE.txt tz.php usr var
-->192.168.226.10(本机ip)-->安装
[root@server1 html]# vim config.inc.php <--按上述要求复制
浏览器访问-->192.168.226.10-->前台
浏览器访问-->192.168.226.10/admin-->访问后台
浏览器访问-->www.natfrp.com/peer_vendors.php(均可实现内网穿透)-->点击natapp-->免费注册-->实名认证
-->购买隧道-->免费隧道{
-->点击教程/文档(学习内网穿透具体步骤)-->NATAPP1分钟快速新手图文教程-->按照教程使用即可}-->下载linux 64客户端
[root@server1 html]# wget https://cdn.natapp.cn/assets/downloads/clients/2_3_9/natapp_linux_amd64/natapp?version=20190730
-->给natapp\?version\=20190730执行权限
[root@server1 html]# ls
1.1-17.10.30-release.tar.gz build index.php install.php natapp?version=20190730 usr
admin config.inc.php install LICENSE.txt tz.php var
[root@server1 html]# chmod a+x natapp\?version\=20190730
[root@server1 html]# ls
1.1-17.10.30-release.tar.gz build index.php install.php natapp?version=20190730 usr
admin config.inc.php install LICENSE.txt tz.php var
-->复制 authtoken-->0cf270b6a326c125
-->运行
[root@server1 html]# ./natapp\?version\=20190730 -authtoken=0cf270b6a326c125
运行成功界面
http://dg9jnb.natappfree.cc成功获得域名,登录即可
浏览器-->typecho主题-->https://www.baidu.com/link?url=lq6N5pk3J0iTE8CL_oaeiOdMkjVrCodNaR4pd8XaRw_&wd=&eqid=828752dd00017f7d00000005610e46d4-->模板下载-->下拉Code-->复制Download ZIP
[root@server1 html]# yum install -y unzip
[root@server1 html]# wget https://github.com/whitebearcode/typecho-bearsimple/archive/refs/heads/master.zip
[root@server1 html]# unzip master.zip
[root@server1 html]# cd usr/themes/
[root@server1 themes]# ll
总用量 4
drwxr-xr-x. 3 root root 251 8月 7 15:36 default <--默认主题文件
[root@server1 themes]# cp -r /var/www/html/typecho-bearsimple-master/ .
[root@server1 themes]# ll
总用量 4
drwxr-xr-x. 3 root root 251 8月 7 15:36 default
drwxr-xr-x. 7 root root 4096 8月 7 17:01 typecho-bearsimple-master
-->进入typecho后台-->更换外观-->启用设置的主题即可
内网穿透,可实现同样的功能
阿里云:https://www.aliyun.com/
登录阿里云官网-->注册(支付宝扫码)-->实名认证
-->选择ESC服务器-->选择进行购买
点击创建实例–>选择付费模式(按量付费)–>选择地址(含有新,惠标签的更便宜)–>选择CPU与内存(实验环境1个CPU,2个G即可)–>选择镜像CentOS7.6)–>下一步
–>设置网络安全组(勾选HTTP 80端口,22端口,3389端口,ICMP协议,其他默认)–>下一步
–>设置密码(自定义)
–>选择默认资源组–>下一步
–>设置使用时间(释放时间,这关系到付多少钱)–>勾选服务协议
–>管理控制台
获得公网地址8.134.116.206
[D:\~]$ ssh root@8.134.116.206
输入密码,即可登录服务器
[root@aliyun-server ~]# getenforce #云服务器默认关闭
Disabled
[root@aliyun-server ~]# systemctl status firewalld
#云服务器默认关闭
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@aliyun-server ~]# yum install -y httpd
[root@aliyun-server ~]# vim /etc/httpd/conf/httpd.conf
添加 ServerName localhost:80
[root@aliyun-server ~]# systemctl start httpd
[root@aliyun-server ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@aliyun-server ~]# yum install mariadb-server mariadb -y
[root@aliyun-server ~]# systemctl start mariadb
[root@aliyun-server ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@aliyun-server ~]# mysql_secure_installation
#初始化,设置密码即可,其他回车
[root@aliyun-server ~]# mysql -uroot -p1 -e"create database blog;show databases;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| blog |
| mysql |
| performance_schema |
+--------------------+
[root@aliyun-server ~]# yum install -y php
[root@aliyun-server ~]# systemctl start php
Failed to start php.service: Unit not found.
[root@aliyun-server ~]# systemctl restart httpd
#LAMP架构中,PHP是以模块的形式追加到Apache的内核中,
#所以启动php就相当于重置Apache软件
[root@aliyun-server ~]# vim /var/www/html/test.php
[root@aliyun-server ~]# cat /var/www/html/test.php
echo 'hello world';
?>
#浏览器访问测试8.134.116.206/test.php
-->hello world
下载地址:https://gitee.com/ComsenzDiscuz/DiscuzX (码云)
[root@aliyun-server ~]# yum install -y lrzsz
[root@aliyun-server ~]# rz
传入下载好的Discuz!软件包
[root@aliyun-server ~]# ls
discuz.zip
[root@aliyun-server ~]# yum install -y unzip
[root@aliyun-server ~]# unzip discuz.zip
[root@aliyun-server ~]# ls
discuz discuz.zip
[root@aliyun-server ~]# mv discuz/* /var/www/html/
[root@aliyun-server ~]# cd /var/www/html/
[root@aliyun-server html]# ls
admin.php archiver crossdomain.xml forum.php index.php member.php portal.php source test.php
api config data group.php install misc.php robots.txt static uc_client
api.php connect.php favicon.ico home.php m plugin.php search.php template uc_server
[root@aliyun-server html]# chmod -R a+w ./
[root@aliyun-server ~]# yum install -y php-mysqli -y
[root@aliyun-server ~]# systemctl restart httpd
–>下一步–>选择全新安装,下一步–>
`