Docker安装Nginx Docker安装nginx docker安装nginx docker部署nginx
Docker安装Nginx Docker安装nginx docker安装nginx docker部署nginx
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

3424

被折叠的 条评论
为什么被折叠?



