docker run -d --name nginx -p 8080:80 -p 8443:443 -v /app/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /app/nginx/conf/vhost/:/etc/nginx/vhost/ -v /app/nginx/conf/ssl/:/etc/nginx/ssl/ -v /app/nginx/logs:/var/log/nginx nginx
docker alpine
docker run -d --name nginx -p 8900:80 -p 8901:443 -v /app/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /app/nginx/conf/vhost/:/etc/nginx/vhost/ -v /app/nginx/conf/ssl/:/etc/nginx/ssl/ -v /app/nginx/logs:/var/log/nginx -v /app/nginx/html:/etc/nginx/html nginx:stable-alpine-perl
基础配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
include vhost/*.conf;
}
http配置
server {
listen 80;
server_name somename alias another.alias;
location / {
root html;
index index.html index.htm;
}
}
https配置
server {
listen 443 ssl;
server_name localhost;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}