Last active
September 26, 2023 16:41
-
-
Save QROkes/bb1b307958ba9260168a to your computer and use it in GitHub Desktop.
NGINX Configuration for WordPress Multisite + Domain Mapping with HTTPS
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; | |
listen [::]:80; | |
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com; | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
server_name example.com www.example.com subsite.com www.subsite.com another.com www.another.com; | |
ssl on; | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem; | |
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; | |
ssl_session_cache shared:SSL:20m; | |
ssl_session_timeout 10m; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT'; | |
ssl_dhparam /etc/ssl/dhparam.pem; | |
add_header X-Frame-Options SAMEORIGIN; | |
add_header X-Content-Type-Options nosniff; | |
add_header X-XSS-Protection "1; mode=block"; | |
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; | |
access_log /var/log/nginx/example.com.access.log rt_cache; | |
error_log /var/log/nginx/example.com.error.log; | |
root /var/www/example.com/htdocs; | |
index index.php index.html index.htm; | |
# WordPress nginx config rules | |
include common/php.conf; | |
include common/wpsubdir.conf; | |
include common/wpcommon.conf; | |
include common/locations.conf; | |
# Custom nginx.conf | |
include /var/www/example.com/conf/nginx/*.conf; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment