个人网站搭建

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了个人网站搭建相关的知识,希望对你有一定的参考价值。

用yum安装LAMP实现wordpress

L linux / A apache(httpd) / M mariadb或mysql / P php

1.配置环境

[root@lsn-106 ~]# setenforce stop selinux ###关闭selinux

[root@lsn-106 ~]# systemctl stop firewalld.service ###关闭防火墙

​[root@lsn-106 ~]# iptables -F ###清空防火墙规则

2.安装lamp架构

[root@lsn-106 ~]# yum install httpd mariadb mariadb-server php php-mysql -y

Installed:

httpd.x86_64 0:2.4.6-97.el7.centos.5 mariadb.x86_64 1:5.5.68-1.el7 mariadb

server.x86_64 1:5.5.68-1.el7 php.x86_64 0:5.4.16-48.el7 php-mysql.x86_64 0:5.4.16-48.el7

Complete!

3.启动服务

[root@lsn-106 ~]# systemctl restart mariadb ###启动数据库

[root@lsn-106 ~]# systemctl restart httpd ###启动apache

[root@lsn-106 ~]# netstat -antup|grep httpd

tcp6 0 0 :::80 :::* LISTEN

10412/httpd

[root@lsn-106 ~]# netstat -antup|grep mysqld

tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

10364/mysqld

4.设置数据库并授权

[root@lsn-106 ~]# mysql

MariaDB [(none)]> create database wordpress;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on wordpress.* to wordpress@localhost

identified by 123456;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;

Query OK, 0 rows affected (0.00 sec)

*****************************************************************************************

grant all privileges on wordpress.* to wordpress@localhost identified by 123456;

授权用户wordpress用户可以本地访问wordpress数据库

5.安装前端wordpress

​[root@lsn-106 ~]# wget https://cn.wordpress.org/wordpress-4.9.22-zh_CN.tar.gz

[root@lsn-106 ~]# tar xvf latest-zh_CN.tar.gz

[root@lsn-106 ~]# ls

anaconda-ks.cfg initial-setup-ks.cfg latest-zh_CN.tar.gz wordpress 公共 模板  视频 图片 文档 下载 音乐 桌面

#########################################################################################

httpd的根目录在/var/www/html

#########################################################################################

[root@lsn-106 ~]# mv wordpress /var/www/html

[root@lsn-106 ~]# cd !$

cd /var/www/html

[root@lsn-106 html]# ls

wordpress

[root@lsn-106 html]# cd wordpress

[root@lsn-106 wordpress]# ls

index.php readme.html wp-admin wp-comments-post.php wp

content wp-includes wp-load.php wp-mail.php wp-signup.php

xmlrpc.php

license.txt wp-activate.php wp-blog-header.php wp-config-sample.php wp

cron.php wp-links-opml.php wp-login.php wp-settings.php wp-trackback.php

[root@lsn-106 html]# chown -R apache:apache wordpress/

[root@lsn-106 html]# ll wordpress

总用量 188

-rw-r--r-- 1 apache apache 418 9月 25 2013 index.php

-rw-r--r-- 1 apache apache 19935 10月 18 10:34 license.txt

-rw-r--r-- 1 apache apache 7415 10月 18 10:34 readme.html

-rw-r--r-- 1 apache apache 6878 12月 13 2018 wp-activate.php

drwxr-xr-x 9 apache apache 4096 10月 18 10:28 wp-admin

-rw-r--r-- 1 apache apache 364 12月 19 2015 wp-blog-header.php

-rw-r--r-- 1 apache apache 1889 5月 3 2018 wp-comments-post.php

-rw-r--r-- 1 apache apache 2853 10月 18 10:34 wp-config-sample.php

drwxr-xr-x 5 apache apache 69 10月 18 10:34 wp-content

-rw-r--r-- 1 apache apache 3669 8月 20 2017 wp-cron.php

drwxr-xr-x 18 apache apache 8192 10月 18 10:34 wp-includes

-rw-r--r-- 1 apache apache 2422 11月 21 2016 wp-links-opml.php

-rw-r--r-- 1 apache apache 3306 8月 22 2017 wp-load.php

-rw-r--r-- 1 apache apache 37804 12月 13 2018 wp-login.php

-rw-r--r-- 1 apache apache 8003 10月 18 02:14 wp-mail.php

-rw-r--r-- 1 apache apache 16246 10月 4 2017 wp-settings.php

-rw-r--r-- 1 apache apache 30091 4月 30 2018 wp-signup.php

-rw-r--r-- 1 apache apache 4689 10月 18 02:14 wp-trackback.php

-rw-r--r-- 1 apache apache 3065 9月 1 2016 xmlrpc.php

#########################################################################################

修改配置文件

[root@lsn-106 html]# vim /etc/httpd/conf/httpd.conf

[root@lsn-106 html]# tail -n3 /etc/httpd/conf/httpd.conf

<VirtualHost *:80>

DocumentRoot /var/www/html/wordpress

</VirtualHost>

#########################################################################################

重启httpd

[root@lsn-106 html]# systemctl restart httpd

mysql -e 可以在数据库外操作

6.访问链接URL

192.168.1.103

个人网站搭建_php

个人网站搭建_php_02

个人网站搭建_html_03

个人网站搭建_apache_04

个人网站搭建_html_05

个人网站搭建_apache_06


以上是关于个人网站搭建的主要内容,如果未能解决你的问题,请参考以下文章

Nginx 实践案例(源码编译安装方式):利用LNMP搭建wordpress站点

Python实战,截图识别文字,过万使用量版本?

Python实战,截图识别文字,过万使用量版本?

如何确定最大堆栈使用量?

如何获取 Youtube API 配额的每日使用量?

云服务器3M带宽可以支持多少用户?带宽用量检测