docker 安装openresty

[复制链接]
发表于 2025-11-22 17:24:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. docker pull openresty/openresty
  2. mkdir -p /root/docker/openresty/nginx
  3. mkdir -p /root/docker/openresty/nginx/lua
  4. mkdir -p /root/docker/openresty/nginx/logs
  5. #运行OpenResty容器拷贝配置文件到宿主服务器上
  6. docker run -d --name openresty -p 7000:80 openresty/openresty
  7. docker cp openresty:/usr/local/openresty/nginx/conf /root/docker/openresty/nginx/conf
  8. docker cp openresty:/usr/local/openresty/nginx/html /root/docker/openresty/nginx/html
  9. docker cp openresty:/etc/nginx/conf.d /root/docker/openresty/nginx/conf.d
  10. #删除容器
  11. docker stop openresty
  12. docker rm openresty
  13. #在/root/docker/openresty/nginx/conf.d目录下添加一个自己的配置文件demo.com.conf(配置和nginx基本一样)
  14. ========================================================
  15. upstream demo.com {
  16.         server ip:port weight=1;
  17. }
  18. server {
  19.     listen       80;
  20.     server_name  localhost;
  21.     location / {
  22.         proxy_pass http://demo.com;
  23.     }
  24.     error_page   500 502 503 504  /50x.html;
  25.     location = /50x.html {
  26.         root   /usr/local/openresty/nginx/html
复制代码
回复

使用道具 举报

登录后关闭弹窗

登录参与点评抽奖  加入IT实名职场社区
去登录
快速回复 返回顶部 返回列表