一、mySQL的安装和环境变量的配置

一、安装

网址:https://dev.mysql.com/downloads/mysql/

密码:2017-08-10T01:05:56.945560Z 1 [Note] A temporary password is generated for root@localhost: pb6T.Zou6S*/If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
以上的安装结束之后的弹框内容(其中的密码是随机数),密码为 pb6T.Zou6S*/

重置密码:把密码改为root

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

mysqladmin -u root -p password 'root'

此时会让你输入旧密码,则输入: pb6T.Zou6S*/

密码修改成功,然后用新密码登录:mysql -u root -p 回车输入新密码

二、环境变量配置

  1. 打开终端,输入: cd  ~  // 会进入~文件夹

  2. 然后输入:sudo vim .bash_profile   回车执行,需要输入root用户密码。sudo是使用root用户修改环境变量文件。
  3. 在文档的输入:export PATH=${PATH}:/usr/local/mysql/bin  然后esc退出insert状态,并在最下方输入:wq保存退出。
  4. 输入:source .bash_profile  回车执行,运行环境变量。
  5. 再输入mysql,即可使用。
  6. 上面的做法每次关掉终端在打开都需要重新source .bash_profile。于是 vi ~/.zshrc,在这里面添加了:

    export PATH=${PATH}:/usr/local/mysql/bin

    保存后 source ~/.zshrc

    这样的话就可以一劳永逸了。

  7. 有的文章中提到修改~/.bashrc,如果系统是zsh的修改bashrc是无效的。 

二、OpenResty的安装和环境变量的配置

一、安装Homebrew

网址:https://brew.sh/index_zh-cn.html

执行脚本:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

二、安装OpenResty

网址:http://openresty.org/en/download.html

网址:brew install homebrew/nginx/openresty

三、OpenResty环境变量配置

参考mysql的配置

也可以把两个配置写在一起

vi ~/.bash_profile

export PATH=$PATH:/usr/local/mysql/bin:/usr/local/opt/openresty/bin:/usr/local/opt/openresty/nginx/sbin export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

三、开始一个OpenResty服务

建立一个test 目录 ,目录下包含conf,log,lua文件夹,在conf文件下新建nginx.conf文件

文件内容为:

worker_processes  1;
error_log logs/error.log;
events {worker_connections 1024;
}
http {server {listen 8080;location / {default_type text/html;content_by_lua '
                ngx.say("<p>hello, world</p>")';
        }}
}

在iTerm中进入test文件夹

运行: nginx -p `pwd`/ -c conf/nginx.conf

重启:nginx -p `pwd`/ -c conf/nginx.conf -s reload

退出:ps -ef | awk '/nginx: master process nginx/{print $2}' | xargs kill

也可以通过关闭该端口号的进程

lsof -i tcp: 8080 // 8080端口的任务进程

然后根据PID杀进程:

sudo kill -9 231  2324 // 231和2324为PID

或者

nginx -s reload  :修改配置后重新加载生效

三、模块介绍

mysql模块:https://github.com/openresty/lua-resty-mysql

Http模块:https://github.com/pintsized/lua-resty-http

WebSocket模块:https://github.com/openresty/lua-resty-websocket

Redis模块:https://github.com/openresty/lua-resty-redis

String模块:https://github.com/openresty/lua-resty-string

四、参考文档

10.1) Wiki,该Wiki有所有nginx lua的各种模块,方法的列表 https://www.nginx.com/resources/wiki/modules/lua/

10.2) Github上关于nginx lua的详细介绍 https://github.com/openresty/lua-nginx-module

10.3) Facebook官方关于React的介绍与教程 https://facebook.github.io/react/docs/hello-world.html

https://facebook.github.io/react/tutorial/tutorial.html

转载于:https://www.cnblogs.com/taryn/p/7339624.html

OpenResity + nginx + mysq配置相关推荐

  1. nginx技术(2)nginx的配置详解

    nginx的配置 1,启动nginx 1 2 3 4 5 6 7 [root@centos6 nginx-1.2.9]# /usr/sbin/nginx -c /etc/nginx/nginx.con ...

  2. 实现nginx上配置免费证书Let's Encrypt

    Let's Encrypt 的免费证书有效期为三个月,不过可以免费续期,写一个脚本定期更新即可. 准备一台nginx 服务器 ,将以下三个附件上传到你的nginx服务器. 1.下载脚本文件,wget ...

  3. 推荐一款 Nginx 可视化配置神器

    以下文章来源方志朋的博客,回复"666"获面试宝典 来源:逛逛GitHub Nginx 是前后端开发工程师必须掌握的神器.该神器有很多使用场景,比如反向代理.负载均衡.动静分离.跨 ...

  4. 九爷带你了解 nginx 日志配置指令详解

    nginx日志配置指令详解 日志对于统计排错来说非常有利的. 本文总结了nginx日志相关的配置如 access_log.log_format.open_log_file_cache.log_not_ ...

  5. php和nginx安装脚本,Nginx + PHP 配置和启动脚本

    Nginx + PHP 配置和启动脚本,很实用 # nginx.conf server { listen 8080 ; server_name localhost; location / { root ...

  6. php修改后nginx返回不生效,nginx修改配置后不生效的问题

    nginx增加了新的server name配置,发现nginx -s reload之后总是不生效. http和https均可以打开页面,但是页面是别的server页面,使用的证书也是别的server的 ...

  7. nginx lua 配置cc 防攻击-使用lua 配置黑白名单

    nginx lua 配置cc 防攻击-使用lua 配置黑白名单 cc 防攻击和ip 禁止期限 lua_shared_dict _dict 1m; lua_shared_dict _blacklist ...

  8. nginx基本配置与参数说明

    user nobody; #启动进程,通常设置成和cpu的数量相等 worker_processes  1; #全局错误日志及PID文件 #error_log  logs/error.log; #er ...

  9. 用Nginx如何配置运行无扩展名PHP文件或非.PHP扩展名文件

    用Nginx如何配置运行无扩展名PHP文件或非.PHP扩展名文件 使用Apache + PHP 很容易做到运行无扩展名的PHP文件. 在Nginx中能做到吗?是可以的. 只需将nginx.conf文件 ...

最新文章

  1. BCH虫洞项目存在不足,但更值得期待!
  2. WinForm禁用窗体自带的关闭功能
  3. 2018python培训-2018python深度学习核心技术培训班
  4. SDK Build Tools revision (19.0.3) is too low for project Minimum required is 19.1.0
  5. 矩阵快速幂 zoj-3690 Choosing number
  6. 课时27.base(掌握)
  7. 50-00-010-配置-kylin-2.6.0官网配置
  8. Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active Dataguard篇
  9. Tomcat服务器下载、安装、配置环境变量教程(超详细)
  10. 人工智能——微粒群优化算法
  11. PCB画板与硬件调试+AD快捷键小技巧
  12. 用安卓手机搭建一个可用渗透测试环境/安卓手机搭建linux环境
  13. 揭开关于激光雷达传感器的常见误区——第二部分
  14. 理解一下什么是全栈工程师
  15. 实力破解机器学习的秘密
  16. 33岁跳槽无路,濒临绝望之际受贵人指点,成功上岸阿里(Java岗)
  17. STC12C5A60S2单片机驱动超声波
  18. 华为鸿蒙3.0亮相,搭载设备产业链投资机会带来了POKERTIME129263?
  19. QT生成动态链接库及调用详细步骤
  20. 根轨迹超前校正matlab,[自动化] 基于根轨迹法的超前校正

热门文章

  1. cent os7 安装elasticsearch-7.9.3(伪集群)和kibana-7.9.3
  2. 人脸对齐(六)--ERT算法
  3. 孙鑫-MFC笔记七--文件与注册表
  4. docker教程_1 简介和安装
  5. python卸载_微软再出神器,这次终于对Python下手了!
  6. 操作系统面试基本概念
  7. PAT (Basic Level) Practice1030 完美数列
  8. 包是如何通过交换机的
  9. Hive map side join入门及测试
  10. Spark DataFrame入门详解