首先来看看什么是lampphp
什么是wordpressmysql
今天来讲说如何基于lamp来搭建一个我的博客网站,固然须要用到的是wordpress,还要有数据库来存储数据,有http服务去支持,以及php和数据库的链接。下面来讲一下过程linux
—————————————————————————————————————————————————————sql
环境:CentOS7数据库
IP:172.18.254.103apache
[root@localhost ~]# yum -y install httpd php mariadb-server php-mysql [root@localhost ~]# systemctl stop firewalld [root@localhost ~]# setenforce 0 [root@localhost ~]# vim /etc/selinux/config SELINUX=disabled
[root@localhost ~]# vim /etc/httpd/conf.d/blog.conf <VirtualHost *:80> ServerName blog.zhang.com DocumentRoot "/vhost/blog/htdocs" CustomLog "logs/blog.zhang.com_access_log" combined <Directory "/vhost/blog/htdocs"> Require all granted </Directory> </VirtualHost>
[root@localhost ~]# vim /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip_name_resolve
[root@localhost ~]# mkdir -p /vhost/blog [root@localhost ~]# cd /vhost/blog/ [root@localhost blog]# wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz [root@localhost blog]# ls wordpress-4.9.4-zh_CN.tar.gz [root@localhost blog]# tar -xvf wordpress-4.9.4-zh_CN.tar.gz [root@localhost blog]# ln -sv wordpress htdocs [root@localhost blog]# setfacl -m u:apache:rwx htdocs/
[root@localhost ~]# systemctl restart mariadb [root@localhost ~]# mysql MariaDB [(none)]> create database blog; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on blog.* to 'wpuser'@'172.18.254.%' identified by 'wppass'; Query OK, 0 rows affected (0.00 sec)
[root@localhost ~]# systemctl restart httpd
在windows下编辑C盘:/windows/System32/drivers/etc/hosts文件vim
添加一行:172.18.254.103 blog.zhang.comwindows
保存退出,若是不能保存的话,请设置文件属性中的安全选项使文件可写。浏览器
这样根据网页内容显示设置以后,我的博客网站即搭建完毕。安全