-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordpress.conf
More file actions
51 lines (40 loc) · 1.81 KB
/
Copy pathwordpress.conf
File metadata and controls
51 lines (40 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# /etc/nginx/sites-available/wordpress.conf
# Redirect everything to the main site. We use a separate server statement and NOT an if statement - see https://www.nginx.com/resources/wiki/start/topics/depth/ifisevil/
server {
server_name _;
return 302 $scheme://example.com$request_uri;
}
server {
#listen [::]:80;
listen 80;
server_name example.com;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
location / {
return 301 https://$host$request_uri;
}
}
server {
#listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name example.com;
root /var/www/html/wordpress/;
index index.php;
access_log /var/log/nginx/example.log;
error_log /var/log/nginx/example.error.log;
## replace with your SSL certificate
ssl_certificate /etc/letsencrypt/live/example.com.pem;
ssl_certificate_key /etc/letsencrypt/live/.example.com.pem;
# Enable HSTS. This forces SSL on clients that respect it, most modern browsers. The includeSubDomains flag is optional.
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
# Set caches, protocols, and accepted ciphers. This config will merit an A+ SSL Labs score as of Sept 2015.
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:DH+3DES:!ADH:!AECDH:!MD5';
add_header Referrer-Policy origin always; # make sure outgoing links don't show the URL to the instance
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
include /etc/nginx/sites-available/wp-global-restrictions.conf;
include /etc/nginx/sites-available/wp-general.conf;
}