Skip to content

Commit 811d8db

Browse files
author
Kristan Kenney
authored
Merge pull request hestiacp#1715 from hestiacp/nginx-templates
Nginx templates update & consolidation
2 parents 9e66853 + 0d15f86 commit 811d8db

26 files changed

+371
-767
lines changed

bin/v-add-fastcgi-cache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ cat << EOF > $fastcgi
8181
fastcgi_cache_valid 301 302 10m;
8282
fastcgi_cache_valid 404 10m;
8383
fastcgi_cache_bypass $no_cache;
84-
fastcgi_no_cache $no_cache;
84+
fastcgi_no_cache $no_cache;
85+
set $no_cache 0;
8586
EOF
8687

8788
if [ ! -z "$debug" ]; then

install/deb/templates/web/nginx/php-fpm/drupal7.stpl renamed to install/deb/templates/web/nginx/php-fpm/codeigniter.stpl

Lines changed: 9 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,66 +30,33 @@ server {
3030
access_log off;
3131
}
3232

33-
location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
34-
deny all;
35-
return 404;
36-
}
37-
38-
location ~ \..*/.*\.php$ {
39-
deny all;
40-
return 404;
41-
}
42-
43-
location ~ ^/sites/.*/private/ {
44-
deny all;
45-
return 404;
46-
}
47-
48-
location ~ ^/sites/[^/]+/files/.*\.php$ {
49-
deny all;
50-
return 404;
51-
}
52-
53-
location ~ /vendor/.*\.php$ {
33+
location ~ /\.(?!well-known\/) {
5434
deny all;
5535
return 404;
5636
}
5737

58-
location ~ /\.(?!well-known\/) {
38+
location ~ /(application|system|README.md|CHANGELOG.md|LICENSE) {
5939
deny all;
6040
return 404;
6141
}
6242

6343
location / {
64-
try_files $uri $uri/ /index.php?$query_string;
44+
try_files $uri $uri/ /index.php;
6545
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
66-
try_files $uri @rewrite;
6746
expires 30d;
6847
fastcgi_hide_header "Set-Cookie";
6948
}
7049

71-
location ~ [^/]\.php(/|$)|^/update.php {
72-
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
50+
location ~ [^/]\.php(/|$) {
7351
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
7452
try_files $uri =404;
7553
fastcgi_pass %backend_lsnr%;
7654
fastcgi_index index.php;
77-
fastcgi_param SCRIPT_FILENAME $request_filename;
78-
include /etc/nginx/fastcgi_params;
79-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
55+
include /etc/nginx/fastcgi_params;
56+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
8057
}
81-
82-
location ~ ^/sites/.*/files/styles/ {
83-
try_files $uri @rewrite;
84-
}
85-
}
86-
87-
location @rewrite {
88-
rewrite ^/(.*)$ /index.php?q=$1;
8958
}
9059

91-
rewrite ^/index.php/(.*) /$1 permanent;
92-
9360
location /error/ {
9461
alias %home%/%user%/web/%domain%/document_errors/;
9562
}
@@ -99,8 +66,7 @@ server {
9966
include %home%/%user%/web/%domain%/stats/auth.conf*;
10067
}
10168

102-
include /etc/nginx/conf.d/phpmyadmin.inc*;
103-
include /etc/nginx/conf.d/phppgadmin.inc*;
104-
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
69+
include /etc/nginx/conf.d/phpmyadmin.inc*;
70+
include /etc/nginx/conf.d/phppgadmin.inc*;
71+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
10572
}
106-

install/deb/templates/web/nginx/php-fpm/drupal7.tpl renamed to install/deb/templates/web/nginx/php-fpm/codeigniter.tpl

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ server {
1111
access_log /var/log/nginx/domains/%domain%.log combined;
1212
access_log /var/log/nginx/domains/%domain%.bytes bytes;
1313
error_log /var/log/nginx/domains/%domain%.error.log error;
14-
14+
1515
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
1616
1717
location = /favicon.ico {
@@ -25,66 +25,33 @@ server {
2525
access_log off;
2626
}
2727

28-
location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
29-
deny all;
30-
return 404;
31-
}
32-
33-
location ~ \..*/.*\.php$ {
34-
deny all;
35-
return 404;
36-
}
37-
38-
location ~ ^/sites/.*/private/ {
39-
deny all;
40-
return 404;
41-
}
42-
43-
location ~ ^/sites/[^/]+/files/.*\.php$ {
44-
deny all;
45-
return 404;
46-
}
47-
48-
location ~ /vendor/.*\.php$ {
28+
location ~ /\.(?!well-known\/) {
4929
deny all;
5030
return 404;
5131
}
5232

53-
location ~ /\.(?!well-known\/) {
33+
location ~ /(application|system|README.md|CHANGELOG.md|LICENSE) {
5434
deny all;
5535
return 404;
5636
}
5737

5838
location / {
59-
try_files $uri $uri/ /index.php?$query_string;
39+
try_files $uri $uri/ /index.php;
6040
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
61-
try_files $uri @rewrite;
6241
expires 30d;
6342
fastcgi_hide_header "Set-Cookie";
6443
}
6544

66-
location ~ [^/]\.php(/|$)|^/update.php {
67-
fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
45+
location ~ [^/]\.php(/|$) {
6846
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
6947
try_files $uri =404;
7048
fastcgi_pass %backend_lsnr%;
7149
fastcgi_index index.php;
72-
fastcgi_param SCRIPT_FILENAME $request_filename;
73-
include /etc/nginx/fastcgi_params;
74-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
50+
include /etc/nginx/fastcgi_params;
51+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
7552
}
76-
77-
location ~ ^/sites/.*/files/styles/ {
78-
try_files $uri @rewrite;
79-
}
80-
}
81-
82-
location @rewrite {
83-
rewrite ^/(.*)$ /index.php?q=$1;
8453
}
8554

86-
rewrite ^/index.php/(.*) /$1 permanent;
87-
8855
location /error/ {
8956
alias %home%/%user%/web/%domain%/document_errors/;
9057
}
@@ -94,8 +61,7 @@ server {
9461
include %home%/%user%/web/%domain%/stats/auth.conf*;
9562
}
9663

97-
include /etc/nginx/conf.d/phpmyadmin.inc*;
98-
include /etc/nginx/conf.d/phppgadmin.inc*;
99-
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
64+
include /etc/nginx/conf.d/phpmyadmin.inc*;
65+
include /etc/nginx/conf.d/phppgadmin.inc*;
66+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
10067
}
101-

install/deb/templates/web/nginx/php-fpm/codeigniter2.stpl

Lines changed: 0 additions & 65 deletions
This file was deleted.

install/deb/templates/web/nginx/php-fpm/codeigniter2.tpl

Lines changed: 0 additions & 60 deletions
This file was deleted.

install/deb/templates/web/nginx/php-fpm/codeigniter3.stpl

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)