当前位置: 首页 > 后端技术 > PHP

swoole+nginx+smarty+umeditor制作的入门博客

时间:2023-03-30 00:25:17 PHP

环境配置:win10+vmwareworkstationubuntu16.04nginx+mysql+swoole+smarty+umeditor具体环境可以百度项目地址:https://github.com/jitaoneng/...项目主要探讨swoole如何开发网站,当然swoole比起开发网站更适合后端API服务,但是道理是一样的。项目中使用nginx作为反向代理。js、css、jpg等静态资源由nginx自己处理。遇到php代理,由swooleserver处理。配置如下:server{listen80;服务器名称本地主机;设置$web/mnt/hgfs/share/jiswoole/web;根$web;位置/{proxy_http_version1.1;proxy_set_header连接“保持活动状态”;proxy_set_headerX-Real-IP$remote_addr;proxy_passhttp://127.0.0.1:9501;~*.(ico|gif|bmp|jpg|png|swf|js|css|mp3)${root$web;}}路由做了最简单的处理,只支持http://localhost/controller/a..。这种打开swoolehttp服务器的入口文件web/index.php也是最简单的CREATETABLE`user`(`id`int(11)NOTNULLAUTO_INCREMENTCOMMENT'自增id',`username`varchar(255)NOTNULLCOMMENT'用户名',`password_hash`varchar(255)NOTNULLCOMMENT'加密密码',PRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=3DEFAULTCHARSET=utf8COMMENT='membertable';CREATETABLE`post`(`id`int(11)NOTNULLAUTO_INCREMENTCOMMENT'fromID',`title`varchar(255)DEFAULTNULLCOMMENT'title',`content`textCOMMENT'content',PRIMARYKEY(`id`),)ENGINE=InnoDBAUTO_INCREMENT=117DEFAULTCHARSET=utf8COMMENT='articleMain桌子';umeditor在配置图片上传的时候需要注意上传请求地址为http://localhost/index/imageUp项目controller文件在app/controller中,view文件通过php在app/view/template中。/web/index.php运行swooleserver

最新推荐
猜你喜欢