Docker安装Nginx Docker安装nginx docker安装nginx docker部署nginx

Docker安装Nginx Docker安装nginx docker安装nginx docker部署nginx

Docker常用容器镜像

1、拉取Nginx

docker pull registry.cn-shenzhen.aliyuncs.com/liyang_main/java_environment:nginx-1.24.0

2、准备宿主机上的目录

在宿主机创建 Nginx挂载目录,将Nginx容器内的目录挂载到宿主机

2.1、创建宿主机挂载目录

mkdir -p /www/nginx/conf
mkdir -p /www/nginx/html
mkdir -p /www/nginx/logs

2.1、创建 nginx.conf

cd /www/nginx/conf
vim nginx.conf

nginx.conf 默认配置内容

worker_processes 1;

events {
   
   
    worker_connections 1024;
}

http {
   
   

	   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;
	
	   include /etc/nginx/mime.types;
	   default_type application/octet-stream;
	
	   charset utf-8;
	   sendfile on;
	   tcp_nopush on;
	   tcp_nodelay on;
	   
	   # 连接超时时间
	   keepalive_timeout 60;
	   types_hash_max_size 2048;
	   types_hash_bucket_size 64;
	   server_tokens off;
	   client_max_body_size 16m;
	   client_body_buffer_size 128k;
	   client_header_buffer_size 128k;
	   open_file_cache max=102400 inactive=20s;
	   open_file_cache_valid 30s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值