|
upstream browser-sync-app { |
|
server host.docker.internal:3000; |
|
} |
|
|
|
map $http_upgrade $connection_upgrade { |
|
default upgrade; |
|
'' close; |
|
} |
|
|
|
server { |
|
listen 80; |
|
listen [::]:80; |
|
server_name $domain; |
|
|
|
location / { |
|
rewrite ^ https://$host$request_uri? permanent; |
|
} |
|
} |
|
|
|
server { |
|
listen 443 ssl http2; |
|
listen [::]:443 ssl http2; |
|
server_name $domain www.$domain; |
|
|
|
add_header Strict-Transport-Security "max-age=31536000" always; |
|
|
|
ssl_session_cache shared:SSL:20m; |
|
ssl_session_timeout 10m; |
|
|
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; |
|
ssl_prefer_server_ciphers on; |
|
ssl_ciphers "ECDH+AESGCM:ECDH+AES256:ECDH+AES128:!ADH:!AECDH:!MD5;"; |
|
|
|
root /var/www/html; |
|
index index.php; |
|
|
|
access_log /var/log/nginx/access.log; |
|
error_log /var/log/nginx/error.log; |
|
|
|
ssl_certificate /etc/certs/$domain.crt; |
|
ssl_certificate_key /etc/certs/$domain.key; |
|
|
|
gzip on; |
|
gzip_http_version 1.0; |
|
gzip_disable "msie6"; |
|
gzip_vary on; |
|
gzip_proxied any; |
|
gzip_comp_level 6; |
|
gzip_buffers 16 8k; |
|
gzip_min_length 256; |
|
gzip_types |
|
text/css |
|
text/javascript |
|
text/xml |
|
text/plain |
|
text/x-component |
|
application/javascript |
|
application/json |
|
application/xml |
|
application/rss+xml |
|
font/truetype |
|
font/opentype |
|
application/vnd.ms-fontobject |
|
image/svg+xml; |
|
|
|
client_max_body_size 100M; |
|
|
|
location / { |
|
try_files $uri $uri/ /index.php?$args; |
|
} |
|
|
|
# Src: https://gist.github.com/micho/1712812 |
|
location /sync { |
|
proxy_pass http://browser-sync-app; |
|
# proxy_set_header Host $host; |
|
# proxy_set_header X-Real-IP $remote_addr; |
|
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
|
# proxy_set_header X-Client-Verify SUCCESS; |
|
# proxy_set_header X-Client-DN $ssl_client_s_dn; |
|
# proxy_set_header X-SSL-Subject $ssl_client_s_dn; |
|
# proxy_set_header X-SSL-Issuer $ssl_client_i_dn; |
|
# proxy_read_timeout 1800; |
|
# proxy_connect_timeout 1800; |
|
} |
|
|
|
# BrowserSync websocket |
|
# Src: https://stackoverflow.com/questions/27713016/how-to-make-browsersync-work-with-an-nginx-proxy-server |
|
location /browser-sync/socket.io/ { |
|
proxy_pass http://browser-sync-app; |
|
proxy_http_version 1.1; |
|
proxy_set_header Upgrade $http_upgrade; |
|
proxy_set_header Connection "Upgrade"; |
|
} |
|
|
|
location ~ \.php$ { |
|
try_files $uri =404; |
|
fastcgi_split_path_info ^(.+\.php)(/.+)$; |
|
fastcgi_pass wordpress:9000; |
|
fastcgi_index index.php; |
|
include fastcgi_params; |
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
|
fastcgi_param PATH_INFO $fastcgi_path_info; |
|
} |
|
} |