博客新站规划(一)——(整体规划)

微笑、不失礼 提交于 2019-11-29 14:00:25
导读 博客是以网络作为载体,简易迅速便捷地发布自己的心得,及时有效轻松地与他人进行交流,再集丰富多彩的个性化展示于一体的综合性平台,那么如何建立一个博客新站呢?

第一部分:系统优化与安全部分

1:开启ssh密钥登录,并禁用ssh密码认证,同时修改其ssh端口为 "13520"

2:为系统创建普通账户wsfnk,禁止root直接登录,运行普通用户使用key登录

3:对历史命令添加时间戳

vi /etc/profile		#将下面内容添加进去    export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S  "  HISTSIZE=1000

4:修改系统时区为上海

cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

5:锁定apache,mysql,nginx,ftp,games,nobody,postfix,ntp等无需登录的用户

6:修改linux系统打开最大文件数(修改如下文件,添加下面内容:表示修改为65536,重启后 ulimit -n 可以验证)

vi /etc/security/limits.conf    *               soft   nofile       65536  *               hard   nofile       65536

第二部分:应用程序部署与安全配置部分

6:指定ftp用湖fnkftp的家目录在/web-boke/html目录,并将其限定在html目录里

chroot_local_user=YES

7:mysql5.7的安装,参看https://boke.wsfnk.com/archives/49.html

8:将mysql端口改成13522,并只监听127.0.0.1,且root不能远程管理,并创建数据库sjk普通账户,管理博客boke数据库

cat /etc/my.cnf    # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html  [mysqld]  port=13522  bind-address=127.0.0.1  datadir=/web-boke/mysql-data  socket=/web-boke/mysql-data/mysql.sock  log-error=/web-boke/mysql-data/mysqld.log  pid-file=/web-boke/mysql-data/mysqld.pid  symbolic-links=0  character-set-server=utf8    #log-error=/var/log/mysqld.log  #pid-file=/var/run/mysqld/mysqld.pid  [mysql]  socket=/web-boke/mysql-data/mysql.sock  default-character-set=utf8  #  [client]  socket=/web-boke/mysql-data/mysql.sock  default-character-set=utf8

9:编译安装nginx,并加载lua + ngx_lua_waf模块实现waf功能,参看https://boke.wsfnk.com/archives/334.html

10:将php.ini最大上传限制改成8M,时区改成上海

vi /etc/php.ini    date.timezone = "Asia/Shanghai"  upload_max_filesize = 8m

11:php-fpm优化,将其改成执行200次php请求后,将内存释放给操作系统,并将进程端口改成13521

vi /etc/php-fpm.d/www.conf    listen = 127.0.0.1:13521  pm.max_requests = 200

12:nginx优化的优化,参看https://boke.wsfnk.com/archives/47.html

第三部分:监控与分析部分

13:每周校验网站/web-boke/html代码的md5值

cat /home/wsfnk/md5_check.sh    #!/bin/bash  find /web-boke/html -name "*.*" |while read line  do  md5sum $line >> boke-md5-check-`date "+%Y-%m-%d"`  done

14:配置filebeat,将nginx日志发送到ELK分析平台上

#filebeat安装  	#配置yum源(选择版本号为5的,因为版本6的document_type字段好像不能使用了)  	vi /etc/yum.repos.d/filebeat.repo    [elastic-5.x]  name=Elastic repository for 5.x packages  baseurl=https://artifacts.elastic.co/packages/5.x/yum  gpgcheck=1  gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch  enabled=1  autorefresh=1  type=rpm-md    	#安装filebeat5  	yum install filebeat -y    	#配置filebeat  	vi /etc/filebeat/filebeat.yml    filebeat.prospectors:  - input_type: log    paths:      - /var/log/nginx/access.log    document_type: wsfnk-nginx-access  #------------ Logstash output -----------------  output.logstash:    # The Logstash hosts    hosts: ["223.84.153.80:5044"]    	#启动  	systemctl start filebeat  	systemctl enable filebeat

原文来自: https://www.linuxprobe.com/profile-linux.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!