Uninote
Uninote
用户根目录
工作日志

站群部署方式

数据库创建与表的建立

  1. 数据库: 名称,zhanqun 编码utf8mb4
  2. 表: 找到项目下面的zhanqun.sql结构文件导入就行
  3. 需要在数据库的t_admin 表添加一条记录, 密码是用md5生成的32为小写 https://md5jiami.51240.com/

项目配置

  1. 修改数据库链接信息
	<?php
	// +----------------------------------------------------------------------
	// | ThinkPHP [ WE CAN DO IT JUST THINK ]
	// +----------------------------------------------------------------------
	// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
	// +----------------------------------------------------------------------
	// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
	// +----------------------------------------------------------------------
	// | Author: liu21st <liu21st@gmail.com>
	// +----------------------------------------------------------------------
	$config = [
		// 数据库类型
		'type'            => 'mysql',
		// 服务器地址
		'hostname'        => '127.0.0.1',
		// 数据库名
		'database'        => 'zhanqun',
		// 用户名
		'username'        => 'root',
		// 密码
		'password'        => 'root',
		// 端口
		'hostport'        => '3306',
		// 连接dsn
		'dsn'             => '',
		// 数据库连接参数
		'params'          => [],
		// 数据库编码默认采用utf8
		'charset'         => 'utf8',
		// 数据库表前缀
		'prefix'          => '',
		// 数据库调试模式
		'debug'           => true,
		// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
		'deploy'          => 0,
		// 数据库读写是否分离 主从式有效
		'rw_separate'     => false,
		// 读写分离后 主服务器数量
		'master_num'      => 1,
		// 指定从服务器序号
		'slave_no'        => '',
		// 自动读取主库数据
		'read_master'     => false,
		// 是否严格检查字段是否存在
		'fields_strict'   => true,
		// 数据集返回类型
		'resultset_type'  => 'array',
		// 自动写入时间戳字段
		'auto_timestamp'  => false,
		// 时间字段取出后的默认时间格式
		'datetime_format' => 'Y-m-d H:i:s',
		// 是否需要进行SQL性能分析
		'sql_explain'     => false,
		// Builder类
		'builder'         => '',
		// Query类
		'query'           => '\\think\\db\\Query',
		// 是否需要断线重连
		'break_reconnect' => false,
		// 断线标识字符串
		'break_match_str' => [],
	];

	if (is_file(__DIR__ . '/local_database.php')) {
		$local_config = require __DIR__ . '/local_database.php';
		$config = array_merge($config, $local_config);
	}

	return $config;
  1. redis必须打开,不要设置密码,因为php如果要用session要redis才行
  2. php.ini 文件需要修改上传文件限制大小

nginx 配置

worker_processes  1;
events {
    worker_connections  1024;
}

http {
    include       ../mime.types;
    default_type  application/octet-stream;
    # 打开文件目录浏览功能
    autoindex on;
    autoindex_exact_size off;
    autoindex_localtime on;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    client_max_body_size 50m;

    #gzip  on;
    server {
        listen      80;
        server_name www.shop.com;
        index       index.html index.htm index.php default.html default.htm default.php;
        root        /Users/liaocheng/workspace/xunwu/zhanqun/public;

        #
        location ~ \.php$ {
            #root           html;
            #root           /Users/liaocheng/PhpstormProjects/;
            root            /Users/liaocheng/workspace/xunwu/zhanqun/public;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            # fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        ../fastcgi_params;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|php)$ {
        }
        error_page   500 502 503 504  /50x.html;
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}



    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
    include ../servers/*;
}

项目使用

  1. 访问后台管理系统地址是 http://www.shop.com/?s=/admin/website/index
  2. 前端访问地址是 http://www.shop.com/
  3. 创建站点的时候需要注意,如果没有配置本地代理域名(www.shop.com),只是配置的ip的话,如果不是80端口,那么创建站点的时候要把端口也加上,比如像下面这样写, 这样首页通过ip加端口访问的形式就可以访问网站的信息了
  4. 创建完成状态默认是关闭的,需要去修改状态为S_ON,不然前端没法访问

线上问题

19-03

点赞(0) 阅读(278) 举报
目录
标题