server { listen 80; server_name doc.ruby-lang.org; location /.well-known/acme-challenge { default_type "text/plain"; root /var/www/html; } location / { return 301 https://docs.ruby-lang.org$request_uri; } } server { listen 80; server_name docs.ruby-lang.org; location /.well-known/acme-challenge { default_type "text/plain"; root /var/www/html; } location / { return 301 https://docs.ruby-lang.org$request_uri; } } # for certbot acme challenge server { listen 80; server_name docs-origin.ruby-lang.org; location / { root /var/www/html; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name docs.ruby-lang.org docs-origin.ruby-lang.org; ssl on; ssl_certificate /etc/letsencrypt/live/docs-origin.ruby-lang.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/docs-origin.ruby-lang.org/privkey.pem; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; # about 40000 sessions ssl_session_tickets off; ssl_dhparam /etc/nginx/dhparam.pem; # intermediate configuration ssl_protocols TLSv1.2; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; # OCSP stapling ssl_stapling on; ssl_stapling_verify on; # verify chain of trust of OCSP response using Root CA and Intermediate certs ssl_trusted_certificate /etc/letsencrypt/live/docs-origin.ruby-lang.org/chain.pem; resolver 8.8.8.8; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Port 443; location / { root /var/www/docs.ruby-lang.org/current/public; index index.html; add_header Cache-Control "public, max-age=43200, s-maxage=172800, stale-while-revalidate=86400, stale-if-error=604800"; add_header Surrogate-Key "index"; location ~ ^/en/trunk(.*) { return 301 https://docs.ruby-lang.org/en/master$1; } location ~ ^/(en|ja)/2\.8\.0(.*) { return 302 https://docs.ruby-lang.org/$1/master$2; } location ~ ^/(en|ja)/(.+?)/ { add_header Cache-Control "public, max-age=43200, s-maxage=172800, stale-while-revalidate=86400, stale-if-error=604800"; add_header Surrogate-Key "docs $1 $2 $1/$2"; } } location /ja/search { proxy_pass http://localhost:9292; } location ~ /ja/search/(css|javascripts) { rewrite ^/ja/search/(.+)$ /$1 break; root /var/rubydoc/rurema-search/current/public; add_header Cache-Control "public, max-age=43200, s-maxage=172800, stale-while-revalidate=86400, stale-if-error=604800"; add_header Surrogate-Key "rurema-search-assets"; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } } server { listen 9292; server_name localhost; root /var/rubydoc/rurema-search/current/public; passenger_enabled on; # add_header Cache-Control "private"; add_header Cache-Control "public, max-age=3600, s-maxage=172800, stale-while-revalidate=86400, stale-if-error=60"; add_header Surrogate-Key "rurema-search-app"; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name doc.ruby-lang.org; ssl on; ssl_certificate /etc/letsencrypt/live/doc.ruby-lang.org/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/doc.ruby-lang.org/privkey.pem; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; # about 40000 sessions ssl_session_tickets off; ssl_dhparam /etc/nginx/dhparam.pem; # intermediate configuration ssl_protocols TLSv1.2; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; # OCSP stapling ssl_stapling on; ssl_stapling_verify on; # verify chain of trust of OCSP response using Root CA and Intermediate certs ssl_trusted_certificate /etc/letsencrypt/live/doc.ruby-lang.org/chain.pem; resolver 8.8.8.8; return 301 https://docs.ruby-lang.org$request_uri; }