-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaravel.conf
76 lines (60 loc) · 2.42 KB
/
laravel.conf
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
server {
root /var/www/cms.example.com/public;
# Subdomain
server_name cms.example.com;
# Main Domain
# server_name example.com www.example.com;
# HTTPS Redirect
# proxy_set_header X-Forwarded-Proto $scheme;
# if ($http_x_forwarded_proto != 'https'){
# return 301 https://$host$request_uri;
# }
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.php index.html index.htm;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
# Restrict access via HtPasswd
# auth_basic "Restricted Content";
# auth_basic_user_file /etc/nginx/.htpasswd;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
# REQUIREMENTS : Enable PHP 7.4 Support
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
# PERFORMANCE : Set expires headers for static files and turn off logging.
location ~* ^.+\.(js|css|swf|xml|txt|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires 30d;
}
# Appended & Managed by Certbot Script (Optional)
# Remove if you want to serve on HTTP
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/cms.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/cms.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# Appended & Managed by Certbot Script (Optional)
# Remove if you want to serve on HTTP
# Ref: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-18-04
server {
if ($host = cms.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name cms.example.com;
listen 80;
return 404; # managed by Certbot
}