相信很多喜欢看小说的朋友都碰见过这种情况:看小说的时候突然点错了,然后就进入广告,甚至满篇文章都被广告遮完了。今天xiaotaiqi就来分享给大家一个运用ptcms搭建一个自己的小说网站的方法,还可以自动采集。(附源码和最新采集规则,大家进入后把采集规则删除重新添加就行)
首先,搭站,你需要服务器,这个大家参照我的那篇服务器购买的文章进行,今天用的是阿里云的免费服务器,感谢马爸爸。。。。大家如果想先试一下,都可以去试试阿里云的免费服务器。
优惠上云,来阿里云·云小站www.aliyun.com![92adcb27c2b8096828cdb6eb5f4afd65.png](https://img-blog.csdnimg.cn/img_convert/92adcb27c2b8096828cdb6eb5f4afd65.png)
今天重新开始吧,首先我们购买服务器,阿里云的服务器买时没有密码需要设置密码:
![6ebf53992b2c1314a3914f567dd918ad.png](https://img-blog.csdnimg.cn/img_convert/6ebf53992b2c1314a3914f567dd918ad.png)
点重置实例密码就行,然后它会重启。接下来把你的服务器IP地址复制,用下shell或者putty连接这些在网上就可以下载,算了,我把地址放在这里吧:
puttywww.chiark.greenend.org.uk xshellwww.netsarang.comxshell用家庭学校版的就行,免费,到时候它会把下载链接发到你的邮箱。
![46ac55a24d1a679034c1aaf8607a35d3.png](https://img-blog.csdnimg.cn/img_convert/46ac55a24d1a679034c1aaf8607a35d3.png)
把公有IP复制,接下来用的这个。
![28b115494956f25bc1f50734fcfa0dfc.png](https://img-blog.csdnimg.cn/img_convert/28b115494956f25bc1f50734fcfa0dfc.png)
点击新建
![8dddeb06b021562c01bab390cd81547e.png](https://img-blog.csdnimg.cn/img_convert/8dddeb06b021562c01bab390cd81547e.png)
然后名称你可以随便取,我就取成”xiaotaiqi演示“吧。主机这里填写你的IP地址,也就是刚刚让你复制的那个,把它粘贴。
![e782facca046f37a66933afa7dbf9e3e.png](https://img-blog.csdnimg.cn/img_convert/e782facca046f37a66933afa7dbf9e3e.png)
端口一般都是22,不需要改。然后点”用户身份验证“:
![cd6be35fd7c3b3e8266af19c72248053.png](https://img-blog.csdnimg.cn/img_convert/cd6be35fd7c3b3e8266af19c72248053.png)
用户名就是”root“,,密码就是你刚刚重置实例的密码。
![9d5dd1a87cf8ce0612b6c19b76fd8415.png](https://img-blog.csdnimg.cn/img_convert/9d5dd1a87cf8ce0612b6c19b76fd8415.png)
连接,然后就会出现这个:
![19f91ed7caecfc66f3382c38907b7216.png](https://img-blog.csdnimg.cn/img_convert/19f91ed7caecfc66f3382c38907b7216.png)
![33f3ad9ee93295fb55623aa30042604a.png](https://img-blog.csdnimg.cn/img_convert/33f3ad9ee93295fb55623aa30042604a.png)
点“接受并保存”
![098815b5d039e5fdc7af388cae950730.png](https://img-blog.csdnimg.cn/img_convert/098815b5d039e5fdc7af388cae950730.png)
这个就是连接成功了,接下来就是安装宝塔面板,看你的系统是哪个就安装哪个哈。
宝塔linux面板命令大全 - 宝塔面板www.bt.cn![eafa1af5fe6419765ed699d42d8c2138.png](https://img-blog.csdnimg.cn/img_convert/eafa1af5fe6419765ed699d42d8c2138.png)
![7245bebcd641e111249887b868f5f014.png](https://img-blog.csdnimg.cn/img_convert/7245bebcd641e111249887b868f5f014.png)
我的系统是centos所以我就用
![e031f0c5c386e59d37733d109d530d8e.png](https://img-blog.csdnimg.cn/img_convert/e031f0c5c386e59d37733d109d530d8e.png)
第一个这个,把它复制,粘贴到这里,记住,这里只可以点鼠标右键点粘贴,不可以快捷键的,复制也是,然后按”ENTER“确定。
![8d20fd9da89c988cb7b13900dcb1ce91.png](https://img-blog.csdnimg.cn/img_convert/8d20fd9da89c988cb7b13900dcb1ce91.png)
然后会出现这个,这里就填”y“就按一下”y“键就行,继续”ENTER“确定。
![0e064b9bc9d01da5d7b6a0f984d2be2c.png](https://img-blog.csdnimg.cn/img_convert/0e064b9bc9d01da5d7b6a0f984d2be2c.png)
然后出现这个就代表安装完成了,它会把面板地址和用户名还有密码都放在那里
![432c4e0b03bf66687b8c1f82fe47b578.png](https://img-blog.csdnimg.cn/img_convert/432c4e0b03bf66687b8c1f82fe47b578.png)
![95b5964b0e3122462e92dbc47115c967.png](https://img-blog.csdnimg.cn/img_convert/95b5964b0e3122462e92dbc47115c967.png)
把它们都复制下来,粘贴到新建文本里面,因为我们到时候需要它。打开浏览器,把内网面板地址复制粘贴到浏览器,有时候有些人打不开,如果不是网络的问题就是防火墙没有放行8888端口,去阿里云服务器那里把8888端口放行。
阿里云ECS无法打开面板的解决方法-阿里云安全组放行教程 - Linux面板 - 宝塔面板论坛www.bt.cn![eafa1af5fe6419765ed699d42d8c2138.png](https://img-blog.csdnimg.cn/img_convert/eafa1af5fe6419765ed699d42d8c2138.png)
这是旧版,其实差不多,那里也可以使用旧版
![684d675ffd37d529eb11d583aa560ca2.png](https://img-blog.csdnimg.cn/img_convert/684d675ffd37d529eb11d583aa560ca2.png)
安全组那里就可以打开,点击,然后游配置规则,进去配置就好了。
阿里云ECS服务器快速设置安全组放行需要端口过程-云主机优惠网www.rakvps.com![79891c9b833fb54adf9747bffe128aad.png](https://img-blog.csdnimg.cn/img_convert/79891c9b833fb54adf9747bffe128aad.png)
按这个就行。
![4bdb49ed2dac464908899b6cb1240e7f.png](https://img-blog.csdnimg.cn/img_convert/4bdb49ed2dac464908899b6cb1240e7f.png)
然后输入你的账户密码,就是刚刚给你那个,登录。
Nginx 1.15.10
安装php版本7.3
安装php扩展 fileinfo
安装php扩展 memcached
安装php扩展 memcache
安装php扩展 swoole或者swoole4
安装php扩展 swoole_serialize(可选)
取消php禁用函数 shell_exec,在PHP里面删除这个参数
安装MySQL版本5.6
这是我选择的运行环境。我们一步步来哈:
![c68deba68aa8c600c3df73525f75112f.png](https://img-blog.csdnimg.cn/img_convert/c68deba68aa8c600c3df73525f75112f.png)
这样,然后一键安装
![1201ab98e490c82d3182ac56286cef1d.png](https://img-blog.csdnimg.cn/img_convert/1201ab98e490c82d3182ac56286cef1d.png)
我们等它安装完成就行。需要几分钟,我把源码链接放在这里。因为我没有搭私人网盘我就用谷歌云盘了哈,因为有几个版本,我不一个一个放出来了,就拿4.2.8版哈:
源码和采集规则,以及安装教程drive.google.com![01aaee0352a55d99b59544e7c1bf9535.png](https://img-blog.csdnimg.cn/img_convert/01aaee0352a55d99b59544e7c1bf9535.png)
我们的安装已经完成了,接下来就是安装
php扩展 fileinfo
安装php扩展 memcached
安装php扩展 memcache
安装php扩展 swoole或者swoole4
安装php扩展 swoole_serialize(可选)
取消php禁用函数 shell_exec,在PHP里面删除这个参数
![ba6c67fcfe97a6d25cd35e81e33f1110.png](https://img-blog.csdnimg.cn/img_convert/ba6c67fcfe97a6d25cd35e81e33f1110.png)
软件商店------>已安装
![32e4a53edfcacc0cf3601bf5643fc95c.png](https://img-blog.csdnimg.cn/img_convert/32e4a53edfcacc0cf3601bf5643fc95c.png)
点PHP7.3那个设置
![4db7ab250b0d76ffb26e5b1a03e32fce.png](https://img-blog.csdnimg.cn/img_convert/4db7ab250b0d76ffb26e5b1a03e32fce.png)
![d623f571f1f5a7cbb0b5f3c3fa270f91.png](https://img-blog.csdnimg.cn/img_convert/d623f571f1f5a7cbb0b5f3c3fa270f91.png)
安装扩展,在这里面找到:fileinfo,memcached,swoole或者swoole4,swoole_serialize(可选)然后安装。
![9e2b42eb0b9a001c8e586db90d4f2d91.png](https://img-blog.csdnimg.cn/img_convert/9e2b42eb0b9a001c8e586db90d4f2d91.png)
再点击禁用函数那里:
![5bdaeadc50e4f40e67d5c5cd3ac5d0d9.png](https://img-blog.csdnimg.cn/img_convert/5bdaeadc50e4f40e67d5c5cd3ac5d0d9.png)
把里面这个shell-exec删除。
![5096306f3ebedfcb994bd3110e2d60aa.png](https://img-blog.csdnimg.cn/img_convert/5096306f3ebedfcb994bd3110e2d60aa.png)
接下来,很重要的一步哈,
安装加密Loader
在/www/server目录新建ptcms文件夹
将压缩包根目录里面的 loader73.so和 license复制到刚才新建的ptcms目录
![3e44732f4a4046dfbbf6dd21739d26da.png](https://img-blog.csdnimg.cn/img_convert/3e44732f4a4046dfbbf6dd21739d26da.png)
点击文件,点根目录,找到www,点击进入。
![14cde1d1528087b5263676f002a9a5c2.png](https://img-blog.csdnimg.cn/img_convert/14cde1d1528087b5263676f002a9a5c2.png)
找到server,点击进入。
![71db325fd4b9f6f1a20530e7d413e375.png](https://img-blog.csdnimg.cn/img_convert/71db325fd4b9f6f1a20530e7d413e375.png)
![293a9761f390b07bbfd69be37a81aba6.png](https://img-blog.csdnimg.cn/img_convert/293a9761f390b07bbfd69be37a81aba6.png)
新建目录,命名为“ptcms”
找到网站,添加站点。
![ebcd307365abc1d5ac6cb2e5d3c88769.png](https://img-blog.csdnimg.cn/img_convert/ebcd307365abc1d5ac6cb2e5d3c88769.png)
![fc854aa95c1a77c8df4836d871049c36.png](https://img-blog.csdnimg.cn/img_convert/fc854aa95c1a77c8df4836d871049c36.png)
你们可能没有域名,直接把IP地址放到域名那里就行,今后有了再加进去。提交就行
![402f47cd40841be4f9e58dae18a8b256.png](https://img-blog.csdnimg.cn/img_convert/402f47cd40841be4f9e58dae18a8b256.png)
点根目录那里,就是我这里的tynew.xyz,进去
![5b865f84ac424bde3d140ddf386db09b.png](https://img-blog.csdnimg.cn/img_convert/5b865f84ac424bde3d140ddf386db09b.png)
把这些都删除
![d078d79eb501c3e624f4044d9b05ce07.png](https://img-blog.csdnimg.cn/img_convert/d078d79eb501c3e624f4044d9b05ce07.png)
把源码的压缩文件上传,之所以压缩上传是因为会快一点,到里面在解压会节省时间。
![c91dcfbd1608afbe4bbf6f0d7233f36b.png](https://img-blog.csdnimg.cn/img_convert/c91dcfbd1608afbe4bbf6f0d7233f36b.png)
![062881df35394ca7f0c266ca43e4b059.png](https://img-blog.csdnimg.cn/img_convert/062881df35394ca7f0c266ca43e4b059.png)
开始上传。
![02c19f229384a669a2a46ae9ddd503eb.png](https://img-blog.csdnimg.cn/img_convert/02c19f229384a669a2a46ae9ddd503eb.png)
![9dd003771b7446c29d2f9026b7079089.png](https://img-blog.csdnimg.cn/img_convert/9dd003771b7446c29d2f9026b7079089.png)
得到这个打开
![6725b36fae91c2e2bdbaa8d127fe462e.png](https://img-blog.csdnimg.cn/img_convert/6725b36fae91c2e2bdbaa8d127fe462e.png)
![a7cfb5d50b33f6b2613bbfee455042b9.png](https://img-blog.csdnimg.cn/img_convert/a7cfb5d50b33f6b2613bbfee455042b9.png)
再打开那个(1),在里面去找到 loader73.so和 license复制到刚才新建的ptcms目录
![baf08f824cabf2ceca3edeb1e08f885b.png](https://img-blog.csdnimg.cn/img_convert/baf08f824cabf2ceca3edeb1e08f885b.png)
这两个,复制,粘贴到刚才创建的pcms目录里面去。
进入php7.3设置,在配置文件里面添加代码,代码安装好后,重启PHP或者重载配置
extension=/www/server/ptcms/loader73.so
swoole_license_files=/www/server/ptcms/license
就是这里,拉下去,到最后,把代码复制粘贴上去。
![3f71bbf8970e4849c1a32dc403c68514.png](https://img-blog.csdnimg.cn/img_convert/3f71bbf8970e4849c1a32dc403c68514.png)
![d13c9802c11fc302f2d1d2f0a531eca4.png](https://img-blog.csdnimg.cn/img_convert/d13c9802c11fc302f2d1d2f0a531eca4.png)
保存,重新启动PHP.接下来,接下来我不想写了。。。。
接下来阿,接下来,就打开面板首页,打开ssh终端,记住,这个密码就是你们那个实例的密码,不是宝塔面板的密码。
![65871511b8ac1c9de1cbd751ab8c500a.png](https://img-blog.csdnimg.cn/img_convert/65871511b8ac1c9de1cbd751ab8c500a.png)
![d3a13bb11d91ab60fc2778b21f97affc.png](https://img-blog.csdnimg.cn/img_convert/d3a13bb11d91ab60fc2778b21f97affc.png)
![eaa732c8d909c464f65406cca6a6eee6.png](https://img-blog.csdnimg.cn/img_convert/eaa732c8d909c464f65406cca6a6eee6.png)
这就是连接成功了,我们就开始配置corn,接下来就用代码就行。
cd /www/wwwroot/网站根目录名称/
/www/server/php/73/bin/php kx cron:check
我的网站根目录就是tynew.xyz,你们就把你们的打在网站根目录名称那里,回车。
![6f9b395a53c14e017f6aa4800c3d2e93.png](https://img-blog.csdnimg.cn/img_convert/6f9b395a53c14e017f6aa4800c3d2e93.png)
得到这样,在把第二个复制粘贴,回车。然后关闭就行,再设置伪静态。打开
![5fe7883d4cd8da504cea1867b2107168.png](https://img-blog.csdnimg.cn/img_convert/5fe7883d4cd8da504cea1867b2107168.png)
点击那里的设置,打开,找到伪静态,点击,把这个代码粘贴到那里:
if (!-e $request_filename) {
rewrite ^/(.*) /index.php?s=$1 last;}
![2f877a685e5bd3e33a346dfa6cde614d.png](https://img-blog.csdnimg.cn/img_convert/2f877a685e5bd3e33a346dfa6cde614d.png)
![b1f58cdf4fd8a0052d7e76bf64fb727d.png](https://img-blog.csdnimg.cn/img_convert/b1f58cdf4fd8a0052d7e76bf64fb727d.png)
保存。打开网站根目录,把这两个里面的所有文件复制粘贴到网站目录下也就是像我的”tynew.xyz“目录下面。
![8f601af31de968a9a12111d4ff1022be.png](https://img-blog.csdnimg.cn/img_convert/8f601af31de968a9a12111d4ff1022be.png)
![802bdaa2ad66253357f3d7b5b19f2f5e.png](https://img-blog.csdnimg.cn/img_convert/802bdaa2ad66253357f3d7b5b19f2f5e.png)
点击网站,打开设置,点这个网站目录,把运行目录改成“public”保存,记得把那个访问日志取消掉,不然会很占空间。
![902aa9fb3f21549f5b8a748eaaebca24.png](https://img-blog.csdnimg.cn/img_convert/902aa9fb3f21549f5b8a748eaaebca24.png)
![66c2df39ea0e42f520eeffcf51df7ddb.png](https://img-blog.csdnimg.cn/img_convert/66c2df39ea0e42f520eeffcf51df7ddb.png)
然后,新建标签页
域名/install.php,像我的域名是tynew.xyz,我就在新标签页输入
![1a23480fdf329958b603d8b8215ae547.png](https://img-blog.csdnimg.cn/img_convert/1a23480fdf329958b603d8b8215ae547.png)
回车,到这个界面,这个时候需要数据库。
![20bb881cee08d9ed6cdc28e05483a378.png](https://img-blog.csdnimg.cn/img_convert/20bb881cee08d9ed6cdc28e05483a378.png)
在宝塔面板点击数据库,先把root密码改了,改了之后,添加数据库。
![b145dcd627526b746266e464740ba5d0.png](https://img-blog.csdnimg.cn/img_convert/b145dcd627526b746266e464740ba5d0.png)
![c7015069a569f7b3ca1a206070d5e136.png](https://img-blog.csdnimg.cn/img_convert/c7015069a569f7b3ca1a206070d5e136.png)
密码改成你的root密码,也就是你刚刚改那个,输入数据库名和用户名,访问权限那里改成”所有人“提交就行。然后那个页面就把你的数据库名,用户名,密码填上去就行,其他的不要改,下一步。
![0b0dc7d0e1fb57d46b52d8254c52ec8b.png](https://img-blog.csdnimg.cn/img_convert/0b0dc7d0e1fb57d46b52d8254c52ec8b.png)
进入以下界面,输入网站名称
![1cbcfae0e7d06ab8e467c76611ce99f5.png](https://img-blog.csdnimg.cn/img_convert/1cbcfae0e7d06ab8e467c76611ce99f5.png)
像我这样就行,除了像什么用户名啊,网站名称啊,密码啊,其他的默认,PHP就像我这样就行。
![323d8943265abb0ae5397362557b4916.png](https://img-blog.csdnimg.cn/img_convert/323d8943265abb0ae5397362557b4916.png)
下一步,填入你刚刚的用户名,密码,认证码。登入
![4040114ddad749d6a5773125452c0669.png](https://img-blog.csdnimg.cn/img_convert/4040114ddad749d6a5773125452c0669.png)
得到这样:
![320759244c90e649bb1e40a1a4b41dd1.png](https://img-blog.csdnimg.cn/img_convert/320759244c90e649bb1e40a1a4b41dd1.png)
点规则管理,那个文件里面就有规则,导入就行。
![6b84d5d55d5c04e73c330e1176bbb275.png](https://img-blog.csdnimg.cn/img_convert/6b84d5d55d5c04e73c330e1176bbb275.png)
,接下来我就不写了,我把效果图放在这里看看
![a760c76256dd5ac61b1750f7b3882832.png](https://img-blog.csdnimg.cn/img_convert/a760c76256dd5ac61b1750f7b3882832.png)
![0a6fe5a784afdc1c7538c2a736669aa2.png](https://img-blog.csdnimg.cn/img_convert/0a6fe5a784afdc1c7538c2a736669aa2.png)
对了,安装完毕后,不想官方发现你的域名,最好更改后台统计代码数字和public/static/admin/index.js文件的统计代码数字,即百度统计id更换为自己的。
![9ae3071ca874e6f6f1f6adf7882de87d.png](https://img-blog.csdnimg.cn/img_convert/9ae3071ca874e6f6f1f6adf7882de87d.png)
ps:我首先申明,请不要把它当作商用,只用于学习和研究,我不会用于谋取利益,希望各位也是,要想商用,推荐官网购买,谢谢。其实只要有空,把它做成app也可以的哦。