Skip to content

Commit b74e721

Browse files
committed
simplify HTTP section
thanks to @J0WI (#52)
1 parent 8f2eafc commit b74e721

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

sites-available/matomo.conf

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ server {
22
listen [::]:80; # remove this if you don't want Matomo to be reachable from IPv6
33
listen 80;
44
server_name matomo.example.com;
5-
location / {
6-
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
7-
return 301 https://$host$request_uri;
8-
}
5+
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
6+
return 301 https://$host$request_uri;
97
}
108
server {
119
listen [::]:443 ssl http2; # remove this if you don't want Matomo to be reachable from IPv6
@@ -21,43 +19,43 @@ server {
2119
## replace with your SSL certificate
2220
ssl_certificate /etc/letsencrypt/live/matomo.example.com/fullchain.pem;
2321
ssl_certificate_key /etc/letsencrypt/live/matomo.example.com/privkey.pem;
24-
22+
2523
include ssl.conf; # if you want to support older browsers, please read through this file
2624

2725
add_header Referrer-Policy origin; # make sure outgoing links don't show the URL to the Matomo instance
28-
26+
2927
root /var/www/matomo/; # replace with path to your matomo instance
30-
28+
3129
index index.php;
32-
30+
3331
## only allow accessing the following php files
3432
location ~ ^/(index|matomo|piwik|js/index).php {
3533
include snippets/fastcgi-php.conf; # if your Nginx setup doesn't come with a default fastcgi-php config, you can fetch it from https://github.com/nginx/nginx/blob/master/conf/fastcgi.conf
3634
fastcgi_param HTTP_PROXY ""; # prohibit httpoxy: https://httpoxy.org/
3735
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #replace with the path to your PHP socket file
3836
#fastcgi_pass 127.0.0.1:9000; # uncomment if you are using PHP via TCP sockets
3937
}
40-
38+
4139
## needed for HeatmapSessionRecording plugin
42-
location = /plugins/HeatmapSessionRecording/configs.php {
40+
location = /plugins/HeatmapSessionRecording/configs.php {
4341
include snippets/fastcgi-php.conf;
4442
fastcgi_param HTTP_PROXY "";
4543
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #replace with the path to your PHP socket file
4644
#fastcgi_pass 127.0.0.1:9000; # uncomment if you are using PHP via TCP sockets
4745
}
48-
46+
4947
## deny access to all other .php files
5048
location ~* ^.+\.php$ {
5149
deny all;
5250
return 403;
5351
}
5452

55-
## serve all other files normally
53+
## serve all other files normally
5654
location / {
5755
try_files $uri $uri/ =404;
5856
}
59-
60-
## disable all access to the following directories
57+
58+
## disable all access to the following directories
6159
location ~ /(config|tmp|core|lang) {
6260
deny all;
6361
return 403; # replace with 404 to not show these directories exist

0 commit comments

Comments
 (0)