Created
December 4, 2018 01:10
-
-
Save jueti/2845de5b04755a59e34beaf3f714627f to your computer and use it in GitHub Desktop.
[Docker for Nginx] #docker #nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name www.jasonyang.xin jasonyang.xin; | |
return 301 https://www.jasonyang.xin$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
server_name www.jasonyang.xin jasonyang.xin; | |
ssl_certificate /etc/ssl/certs/1578714_www.jasonyang.xin.pem; | |
ssl_certificate_key /etc/ssl/certs/1578714_www.jasonyang.xin.key; | |
ssl_session_timeout 5m; | |
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_prefer_server_ciphers on; | |
gzip on; | |
gzip_min_length 1k; | |
gzip_comp_level 6; | |
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
nginx: | |
image: nginx | |
volumes: | |
- ./etc/nginx/conf.d:/etc/nginx/conf.d:ro | |
- ./www:/usr/share/nginx/html:ro | |
- ./etc/ssl/certs:/etc/ssl/certs:ro | |
ports: | |
- 80:80 | |
- 443:443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
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; | |
keepalive_timeout 65; | |
#gzip on; | |
include /etc/nginx/conf.d/*.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment