当前位置 主页 > 服务器问题 > nginx问题汇总 >

CentOS7 Docker Nginx部署及运行详解

栏目:nginx问题汇总 时间:2018-12-06 17:14

这篇文章主要介绍了CentOS7 Docker Nginx部署及运行详解,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

网上找了一些资料部署,出现不一样的问题,现在总结一下自己的部署流程。

1、资源准备

Dockerfile文件

# "ported" by Adam Miller <maxamillion@fedoraproject.org> from #  https://github.com/fedora-cloud/Fedora-Dockerfiles # # Originally written for Fedora-Dockerfiles by #  scollier <scollier@redhat.com>  FROM centos:centos7 MAINTAINER The CentOS Project <cloud-ops@centos.org>  RUN yum -y update; yum clean all RUN yum -y install epel-release tar ; yum clean all RUN yum -y install nginx ; yum clean all ADD nginx.conf /opt/deploy/nginx/nginx.conf RUN echo "daemon off;" >> /opt/deploy/nginx/nginx.conf #RUN curl https://git.centos.org/sources/httpd/c7/acf5cccf4afaecf3afeb18c50ae59fd5c6504910 \ #  | tar -xz -C /usr/local/nginx/html \ #  --strip-components=1 #RUN sed -i -e 's/Apache/nginx/g' -e '/apache_pb.gif/d' \  #  /usr/local/nginx/html/index.html  EXPOSE 80  #CMD [ "/usr/local/nginx/sbin" ] 

注意:路径需要在系统上面存在以及对应

nginx.conf文件

# For more information on configuration, see: #  * Official English Documentation: http://nginx.org/en/docs/ #  * Official Russian Documentation: http://nginx.org/ru/docs/  user nginx; worker_processes 1;  error_log /usr/logs/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info;  pid    /run/nginx.pid;   events {   worker_connections 1024; }   http {   include    mime.types;   default_type application/octet-stream;    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 /usr/logs/nginx/access.log main;    sendfile    on;   #tcp_nopush   on;    #keepalive_timeout 0;   keepalive_timeout 65;    #gzip on;    # Load modular configuration files from the /etc/nginx/conf.d directory.   # See http://nginx.org/en/docs/ngx_core_module.html#include   # for more information.   #include /etc/nginx/conf.d/*.conf;    index  index.html index.htm;    server {     listen    80;     server_name localhost;     root     /usr/share/nginx/html;      #charset koi8-r;      #access_log /var/log/nginx/host.access.log main;      location / {       autoindex on;     }      # redirect server error pages to the static page /40x.html     #     error_page 404       /404.html;     location = /40x.html {     }      # redirect server error pages to the static page /50x.html     #     error_page  500 502 503 504 /50x.html;     location = /50x.html {     }      # proxy the PHP scripts to Apache listening on 127.0.0.1:80     #     #location ~ \.php$ {     #  proxy_pass  http://127.0.0.1;     #}      # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000     #     #location ~ \.php$ {     #  root      html;     #  fastcgi_pass  127.0.0.1:9000;     #  fastcgi_index index.php;     #  fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;     #  include    fastcgi_params;     #}      # deny access to .htaccess files, if Apache's document root     # concurs with nginx's one     #     #location ~ /\.ht {     #  deny all;     #}   }     # another virtual host using mix of IP-, name-, and port-based configuration   #   #server {   #  listen    8000;   #  listen    somename:8080;   #  server_name somename alias another.alias;   #  root     html;    #  location / {   #  }   #}     # HTTPS server   #   #server {   #  listen    443;   #  server_name localhost;   #  root     html;    #  ssl         on;   #  ssl_certificate   cert.pem;   #  ssl_certificate_key cert.key;    #  ssl_session_timeout 5m;    #  ssl_protocols SSLv2 SSLv3 TLSv1;   #  ssl_ciphers HIGH:!aNULL:!MD5;   #  ssl_prefer_server_ciphers  on;    #  location / {   #  }   #}  } 



缩小 缩小 缩小 缩小
IIS7整站下载工具 IIS7批量查询排名 IIS7远程桌面连接工具 iis7-iis网站批量管理 iis7批量替换工具 IIS7服务器专用下载工具 IIS7日志分析工具 IIS7批量PING,服务器批量添加网卡IP小工具 IIS7远程同步备份工具
IIS7网站监控 站群批量SEO查询 批量获取排名域名 批量关键词排名查询 模拟各种蜘蛛 批量友情链接监测 批量检测死链 搜索引擎大全 批量查询外链
批量查询网站标题 批量查询KeyWords 批量查询描述 批量查询网站IP 批量百度收录查询 批量查询百度日收录 批量查询百度周收录 批量查询百度月收录 批量查询360总收录 批量查询360日收录 批量查询网站年龄 批量查询360PC权重 批量查询爱站移动权重 批量查询站长移动权重 批量查询360移动权重 批量查询神马权重 批量查询谷歌PR 批量查询搜狗PR 批量查询百度反链 批量查询爱站首页反链 批量查询爱站内页反链 批量查询百度快照 批量查询搜狗快照 批量icp备案查询 批量网站ip地址查询 批量查询导出链接 批量查询百度V认证 批量查询百度安全 批量查询站长PC权重 批量查询爱站PC权重 批量查询搜狗总收录 站长资源大全 IIS7-cms大全 IIS7站群大全 IIS7虚拟空间大全 IIS7服务器大全 IIS7-VPS大全