docker 安装 openresty

网友投稿 1180 2022-09-29

docker 安装 openresty

docker 安装 openresty

openresty-github:pull openresty/openresty:1.19.3.1-alpine

2、新建openresty挂载目录:

mkdir -p /opt/docker/openresty/{conf.d,html,logs,cert}

3、编写openresty容器启动脚本

# vim /opt/docker/openresty/run.sh #!/bin/bashdocker run -itd --restart=unless-stopped \ --network=host \ --name openresty \ -v /opt/docker/openresty/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf \ -v /opt/docker/openresty/conf.d:/etc/nginx/conf.d \ -v /opt/docker/openresty/logs:/usr/local/openresty/nginx/logs \ -v /opt/docker/openresty/html:/usr/local/openresty/nginx/html \ -v /opt/docker/openresty/cert:/usr/local/openresty/nginx/cert \ -v /opt/docker/openresty/run:/var/run/openresty \ -v /opt/docker/openresty/nginx/lua:/usr/local/openresty/nginx/lua \ openresty/openresty:1.19.3.1-alpinedocker logs -f openresty

4、编写建openresty-nginx主配置文件

# vim /opt/docker/openresty/nginx.conf worker_processes 4;#user nginx;events { worker_connections 409600;}{ include mime.types; default_type application/octet-stream; server_tokens off; autoindex on; autoindex_exact_size off; autoindex_localtime on; keepalive_timeout 65; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$' '"$"$ access_log /usr/local/openresty/nginx/logs/access.log main; error_log /usr/local/openresty/nginx/logs/error.log error; include /etc/nginx/conf.d/*.conf;}

5、编写openresty虚拟主机配置文件

vim openresty-443.confserver { listen 80; server_name 127.0.0.1; rewrite ^ permanent; server_tokens off; }server { listen 443 ssl; server_name 127.0.0.1; ssl_certificate /usr/local/openresty/nginx/cert/xxx.com.pem; ssl_certificate_key /usr/local/openresty/nginx/cert/xxx.com.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; charset utf-8; location / { root /usr/local/openresty/nginx/html; index index.php index.html index.htm; } access_log /usr/local/openresty/nginx/logs/access.log main;}

vim openresty.template.conf server { listen 80; server_name 127.0.0.1; charset utf-8; location / { root /usr/local/openresty/nginx/html; index index.php index.html index.htm; } access_log /usr/local/openresty/nginx/logs/access.log main;}

反向代理配置

server { listen 80; server_name 127.0.0.1; location / { proxy_redirect off; proxy_pass } access_log /usr/local/openresty/nginx/logs/access.log main;}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:微信小程序中如何实现子向父传参(页面通信)(小程序父子组件传参)
下一篇:ThinkPHP 5.0 组合多条件whereOr查询,生成sql带括号
相关文章

 发表评论

暂时没有评论,来抢沙发吧~