码迷,mamicode.com
首页 > 其他好文 > 详细

从零开始devops-nginx docker

时间:2020-04-26 17:14:54      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:dev   pes   pos   fas   include   proc   one   cal   star   

nginx

docker compose

version: ‘2.0‘

services:
  nginx:
    restart: always
    image: nginx:latest
    ports:
      - 80:80
      - 7143:7143
      - 5342:5342
    volumes:
      - $NGINX_HOME/conf/nginx.conf:/etc/nginx/nginx.conf
      - $NGINX_HOME/conf.d:/etc/nginx/conf.d
      - $NGINX_HOME/log:/var/log/nginx
      - $NGINX_HOME/html:/var/www

nginx.conf

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;
    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

default.conf


server {
    listen       5342;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/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;
    #}
}

从零开始devops-nginx docker

标签:dev   pes   pos   fas   include   proc   one   cal   star   

原文地址:https://www.cnblogs.com/franzlistan/p/12779434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!