3 Star 4 Fork 1

私はあなたを / 高性能加载模板

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

安装前

支持的环境:
1.php7以上
2.mysql5.6以上

安装教程

1. 第一步
git clone https://gitee.com/huchaoran/muchTemplate.git 
2. 第二步
composer update 
3. 第三步
cp .env.example .env
4. 第四步
php artisan key:generate 
5. 第五步(配置.env的数据库连接)
php artisan migrate 
5. 第六步
php artisan db:seed
5. 第七步
php artisan serve 

使用说明

  • 通过url访问http://localhost:8000/admin,账号和密码都是admin

图片展示

  • 后台主页 Image text
  • 用户 Image text
  • 权限 Image text
  • 消息推送 Image text

新增功能

搭建微服务

  • 这里使用的是laravel框架,基于laravel的组件larvels(laravel+swoole) 框架内运行 php bin/laravels start 并配置nginx.confinclude引入一个新的conf文件,为aa.conf

      gzip on;
      gzip_min_length 1024;
      gzip_comp_level 2;
      gzip_types text/plain text/css text/javascript application/json application/javascript application/x-javascript application/xml application/x-httpd-php image/jpeg image/gif image/png font/ttf font/otf image/svg+xml;
      gzip_vary on;
      gzip_disable "msie6";
      #nginx upstream用于负载均衡
      upstream swoole {
          # 通过 IP:Port 连接
          #多服务器负载均衡(没有服务器,拿端口来顶替),模拟多个服务器
          server 127.0.0.1:5200 weight=5 max_fails=3 fail_timeout=5s;#可设置参数请求
          server 127.0.0.1:5201 weight=5 max_fails=3 fail_timeout=5s;#可设置参数请求
          # 通过 UnixSocket Stream 连接,小诀窍:将socket文件放在/dev/shm目录下,可获得更好的性能
          #server unix:/yourpath/laravel-s-test/storage/laravels.sock weight=5 max_fails=3 fail_timeout=30s;
          #server 192.168.1.1:5200 weight=3 max_fails=3 fail_timeout=30s;
          #server 192.168.1.2:5200 backup;
          keepalive 16;
      }
      
      server {
          listen       80;
          client_max_body_size 512m;
          server_name  aa.com;
          # root  /Users/huchaoran/Desktop/所有项目/muchTemplate/public;
          autoindex off;
          index index.html index.php;
      
          location / {
              # try_files $uri $uri/ /index.php?$query_string;
              try_files $uri @laravels;
          }
          # location ~ \.php(.*)$ {
          #   	fastcgi_pass   127.0.0.1:9000;
          #    	fastcgi_index  index.php;
          #    	fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
          #    	fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          #    	fastcgi_param  PATH_INFO  $fastcgi_path_info;
          #    	fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
          #   	include        fastcgi_params;
          # }
          # location ~ /\.ht {
          #     deny all;
          # }
          # if (!-e $request_filename) {
          #     rewrite ^/(.*)$ /index.php/$1;
          # }
          location @laravels {
              # proxy_connect_timeout 60s;
              # proxy_send_timeout 60s;
              # proxy_read_timeout 120s;
              proxy_http_version 1.1;
              proxy_set_header Connection "";
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Real-PORT $remote_port;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header Host $http_host;
              proxy_set_header Scheme $scheme;
              proxy_set_header Server-Protocol $server_protocol;
              proxy_set_header Server-Name $server_name;
              proxy_set_header Server-Addr $server_addr;
              proxy_set_header Server-Port $server_port;
              access_log  /Users/huchaoran/Desktop/所有项目/muchTemplate/access.log;
              # “swoole”是指上面的upstream定义的swoole
              proxy_pass http://swoole;
          }
      }
  • 配置hosts文件指向到aa.com域名,并重载nginx服务器配置,通过http://aa.com域名访问

基于swoole定时器

  • php artisan timer即可运行,文件在App\Console\Commands\Timer.php

新增实时通讯

  • 该功能与微服务合并在一起,文件在App\Services\WebSocket.php,案例在App\Http\PushController.php

新增异步处理数据(消息队列)

  • 该功能与微服务合并在一起,案例在App\Http\Controllers\TaskWorkController.php,接口在routes\api.php中的taskWork,通过http://XXXX.com/api/taskWork进行触发

空文件

简介

暂无描述 展开 收起
PHP
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/huchaoran/muchTemplate.git
git@gitee.com:huchaoran/muchTemplate.git
huchaoran
muchTemplate
高性能加载模板
master

搜索帮助