如何自己建网站,怎么创建自己的网站
时间:2022-08-10 18:00:01 | 来源:网站运营
时间:2022-08-10 18:00:01 来源:网站运营
Linux Centos系统通过宝塔面板搭建wordpress博客站详细步骤。这篇文章紧接着前面被删掉的那篇经过改良,分享一下。
一、升级Linux内核
yum install
https://www.elrepo.org/elrepo-release-7.0-4.el7.elrepo.noarch.rpm (安装ELRepo仓库)
yum --enablerepo=elrepo-kernel -y install kernel-ml kernel-ml-devel (升级内核)
grub2-set-default 0 (更新grub文件)
reboot (重启)
二、开启谷歌拥塞控制算法bbr
wget -N --no-check-certificate "
https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh (加强版的谷歌拥塞控制算法bbr)
./tcp.sh
wget --no-check-certificate
https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh (安装BBR一键安装脚本)
sysctl net.ipv4.tcp_available_congestion_control (查询)
sysctl net.ipv4.tcp_congestion_control (查询)
sysctl net.core.default_qdisc (查询)
lsmod | grep bbr (查询,出现tcp_bbr模块成功开启)
三、安装服务器安全软件云锁
wget
https://download.yunsuo.com.cn/v3/yunsuo_agent_64bit.tar.gz && tar xvzf yunsuo_agent_64bit.tar.gz && chmod +x yunsuo_install/install && yunsuo_install/install (自动安装云锁)
/usr/local/yunsuo_agent/agent_smart_tool.sh -u (账号) -p (密码) (输入云端账号和密码,启动云锁)
四、安装宝塔面板配置建站环境
yum install -y wget && wget -O install.sh
http://download.bt.cn/install/install_6.0.sh && sh install.sh (安装宝塔面板)
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel (安装编译工具及库文件)
yum install -y pcre pcre-install (自动安装PCRE)
pcre-config --version (查看pcre版本)
yum -y install gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2 flex libaio-devel (安装编译工具及库文件)
wget
https://cmake.org/files/v3.16/cmake-3.16.2.tar.gz (安装cmake编译器)
tar zxvf cmake-3.16.2.tar.gz (解压安装包)
cd cmake-3.16.2 (进入安装包目录)
./bootstrap (编译安装)
make && make install (编译安装)
yum install libevent libevent-devel (安装libevent库)
宝塔面板中编译安装nginx+php+mysql配置建站环境,以上步骤可以忽略。
五、安装ngx_pagespeed模块
bash <(curl -f -L -sS
https://ngxpagespeed.com/install) /
--nginx-version latest
--with-http_ssl_module (启用ssl,宝塔面板已安装nginx,自动安装时会提示已安装)
六、开启CDN加速:
百度免费每日10G加速流量包:su.baidu.com,
百度云加速推广链接:
https://su.baidu.com/?ic=rWWHFc360奇安信网站卫士免费大额流量包:
https://wangzhan.qianxin.com/#七、上传wordpress程序,上传robots.txt文件
八、安装插件
Compress JPEG & PNG images (图片压缩插件)
Google Authenticator (登录二次验证插件)
WPS Hide Login (后台地址修改插件)
WPJAM Basic (网站优化插件)
Nginx Helper (nginx缓存插件)
Redis Object Cache (redis缓存插件)
memcached-is-your-friend (mencached缓存插件)
batcache (网页缓存插件,启用后将插件目录里的advanced-cache.php文件复制到wp-content路径下)
Simple URLs (外链转内链插件)
WP SMTP (邮件通知插件)
baidu-links-submit (百度ping提交插件)
TinyMCE Advanced (写作工具栏插件)
WP Mobile X (手机端模板插件)
九、目录保护
通过在宝塔面板中添加目录保护
/www/wwwroot/
http://gy1205.cn/license.txt//www/wwwroot/
http://gy1205.cn/readme.html//www/wwwroot/
http://gy1205.cn/wp-config-sample.php//www/wwwroot/
http://gy1205.cn/wp-admin/install-helper.php//www/wwwroot/
http://gy1205.cn/wp-admin/install.php/十、wp-config.php文件添加代码开启redis、mencached、batcache缓存扩展
define('ENABLE_CACHE', true);// Memcached is You Friend & Redis Object Cache
define( 'WP_CACHE',true );// Batcache
define( 'WP_MEMORY_LIMIT', '64M' );
define('RT_WP_NGINX_HELPER_CACHE_PATH','/dev/shm/nginx-cache');
十一、放置广告
全民云计算:
https://promotion.aliyun.com/ntms/act/qwbk.html?userCode=cxfeth8y十二、附件
Baidu Links Submit插件下载地址,粘贴到迅雷中下载:
http://bs.baidu.com/zhanzhang/baidu-links-submit-9.23.zipwordpress5.3.2中文版地址,粘贴到迅雷可下载:
https://downloads.wordpress.org/release/zh_CN/wordpress-5.3.2.ziphsts强制开启,添加到配置文件中:add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
十三、防黑加固
修改redis修改默认6379端口
打开redis.conf,找到requirepass所在的地方修改密码,再去掉前面的#号注释符,然后重启redis
修改 redis.conf 文件,添加
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG ""
rename-command KEYS ""
rename-command SHUTDOWN ""
rename-command DEL ""
rename-command EVAL ""
redis配置文件redis.conf文件权限修改为600
修改memcached的监听默认端口`11211`
Mysql,在mysqld 段落中添加:local-infile=0;skip_symbolic_links=yes
修改Mysql默认3306端口
具体可以通过空间服务商提供的加固功能对服务器进行扫描加固。
十四、参考资料
https://www.moerats.com/archives/387/https://www.runoob.com/memcached/memcached-install.htmlhttps://www.runoob.com/linux/nginx-install-setup.htmlhttps://www.runoob.com/linux/mysql-install-setup.htmlhttp://help.yunsuo.com.cn/guide/Lin_inst.htmlhttps://www.bt.cn/bbs/thread-19376-1-1.htmlhttps://linuxeye.com/439.htmlhttps://www.modpagespeed.com/doc/build_ngx_pagespeed_from_sourcehttps://www.ainiseo.com/jianzhan/plugins/1086.htmlhttps://www.wpcom.cn?ref=5201
原文地址: