搭建个人博客网站// listen-on port 53 { 127.0.0.1; };

Posted 三千繁华01

tags:

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

网站搭建前的分析:

    (1)我们需要有DNS解析

    (2)作为网站我们还要为其颁发证书

    (3)搭建网站并连接数据库。

    (4)安装wordpress

 

实现方法:

首先我们需要关闭防火墙和selinux

搭建DNS解析服务器:

[[email protected] ~]# vim /etc/named.conf  

    // listen-on port 53 { 127.0.0.1; };

    // allow-query { localhost; };

  

  

[[email protected] ~]# vim /etc/named.rfc1912.zones 

zone "a.com" IN {
type master;
file "a.com.zones";

};
zone "b.com" IN {
type master;
file "b.com.zones";

};
zone "c.com" IN {
type master;
file "c.com.zones";

};

  

[[email protected] ~]# vim /var/named/a.com.zones

$TTL 1D
@ IN SOA ns admin.a.com. (
                    0 ; serial
                    1D ; refresh
                    1H ; retry
                    1W ; expire
                    3H ) ; minimum
          NS ns
ns            A        192.168.125.131
www         A             192.168.125.134
web         A        192.168.125.134

 

 [[email protected] ~]# vim /var/named/b.com.zones 
$TTL 1D
      @ IN SOA ns admin.b.com. (
                      0 ; serial
                      1D ; refresh
                      1H ; retry
                      1W ; expire
                      3H ) ; minimum
            NS   ns
  ns            A      192.168.125.131
  www         A     192.168.125.134

  

[[email protected] ~]# vim /var/named/c.com.zones

    $TTL 1D
    @ IN SOA ns admin.c.com. (
                        0 ; serial
                        1D ; refresh
                        1H ; retry
                        1W ; expire
                        3H ) ; minimum
            NS    ns
    ns        A      192.168.125.131
    www       A      192.168.125.134

 创建虚拟主机

[[email protected] conf.d]# vim test.conf

NameVirtualHost *:443
<VirtualHost *:443>
ServerName www.b.com
DocumentRoot /app/html2
ErrorLog logs/www.b.com-error_log
CustomLog logs/www.b.com-access_log combined
SSLEngine on
SSLCertificateFile /etc/httpd/conf.d/ssl/httpd.crt
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/httpd.key
SSLCACertificateFile /etc/httpd/conf.d/ssl/cacert.pem
</VirtualHost>
<VirtualHost *:443>
ServerName www.c.com
DocumentRoot /app/html3
ErrorLog logs/www.b.com-error_log
CustomLog logs/www.b.com-access_log combined
SSLEngine on
SSLCertificateFile /etc/httpd/conf.d/ssl/httpd-t.crt
SSLCertificateKeyFile /etc/httpd/conf.d/ssl/httpd.key
SSLCACertificateFile /etc/httpd/conf.d/ssl/cacert.pem


</VirtualHost>

#-------------------------------------------------------------------------
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.a.com
DocumentRoot /app/html1
ErrorLog logs/www.a.com-error_log
CustomLog logs/www.a.com-access_log combined

</VirtualHost>
<VirtualHost *:80>
ServerName www.b.com
DocumentRoot /app/html2
ErrorLog logs/www.b.com-error_log
CustomLog logs/www.b.com-access_log combined

</VirtualHost>

#----------------------------------------------------------------------------
<VirtualHost *:80>
ServerName www.c.com
DocumentRoot /app/html3
ErrorLog logs/www.b.com-error_log
CustomLog logs/www.b.com-access_log combined


</VirtualHost>

  

接着我们要找一台机器作为CA中心专门为我们颁发证书:

[[email protected] ~]# (umask 066;openssl genrsa -out private/cakey.pem 4096)
[[email protected] ~]# openssl req -new -x509 -key private/cakey.pem -out cacert.pem -days 3650
[[email protected]  CA]# touch index.txt
[[email protected] CA]# echo 00 > serial

 

WEB Server生成私钥及请求文件

[[email protected] ssl]# (umask 066;openssl genrsa -out httpd.key 1024)
[[email protected] ssl]# openssl req -new -key httpd.key -out httpd.csr
[[email protected] ssl]# scp httpd.csr [email protected]:/etc/pki/CA
[[email protected] CA]# openssl ca -in httpd.csr -out certs/httpd.crt -days 300
[[email protected] CA]# scp certs/httpd.crt [email protected]:/etc/httpd/conf.d/ssl
vim /etc/httpd/cond.d/ssl.conf
  将httpd.key httpd.crt cacert.pem 写入ssl.conf文件。

  

 安装Apache软件

   yum -y install httpd php php-mysql marisdb

  启动服务:systemctl restart httpd

  初始化数据库:

  

[[email protected] mysql]# mysql_secure_installation
[[email protected] mysql]# mysql -uroot -pcentos

MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on wpdb.* to [email protected]‘%‘ identified by ‘centos‘;
Query OK, 0 rows affected (0.01 sec)

  

4.安装wordpress

4.安装wordpress
[[email protected] src]# cd /usr/local/src/
[[email protected] src]# tar xvf wordpress-4.8.1-zh_CN.tar.gz -C /var/www/html/
[[email protected] html]# ln -s wordpress/ blog
[[email protected] html]# setfacl -m u:apache:rwx blog

  

 

以上是关于搭建个人博客网站// listen-on port 53 { 127.0.0.1; };的主要内容,如果未能解决你的问题,请参考以下文章

0成本搭建个人技术博客和个人网站

手把手教你从0开始搭建个人博客,东半球最详细的保姆级博客搭建部署教程 | 程序员人手必备个人博客网站

从0开始搭建个人博客网站

使用dokcer搭建个人博客网站

哟呵,Github 免费从 0 到 1搭建个人博客网站

如何搭建个人开源博客系统框架