Update 'config/nginx/domainconfig.cf'
This commit is contained in:
@@ -1,22 +1,21 @@
|
||||
cat <<EOF > /etc/nginx/sites-available/"$domain"
|
||||
#fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m max_size=10g inactive=1440m;
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name www.$domain;
|
||||
return 301 http://$domain\$request_uri;
|
||||
server_name www.DOMAINNAME;
|
||||
return 301 http://DOMAINNAME$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
root /var/www/$domain/html;
|
||||
root /var/www/DOMAINNAME/html;
|
||||
index index.php index.html index.htm index.nginx-debian.html;
|
||||
server_name $domain;
|
||||
#return 301 \$scheme:/\$domain\$request_uri; Redirect to non-www
|
||||
#return 301 https://domein.nl$request_uri; Redirect to other domain
|
||||
server_name DOMAINNAME;
|
||||
#return 301 $scheme:/$domain$request_uri; Redirect to non-www
|
||||
#return 301 https://domein.nl; Redirect to other domain
|
||||
|
||||
#add_header X-Cache "\$upstream_cache_status";
|
||||
#add_header X-Cache "$upstream_cache_status";
|
||||
|
||||
#netdata here
|
||||
|
||||
@@ -29,32 +28,32 @@ server {
|
||||
|
||||
# location /rspamd {
|
||||
# proxy_pass http://127.0.0.1:11334/;
|
||||
# proxy_set_header Host \$host;
|
||||
# proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
#}
|
||||
|
||||
location / {
|
||||
#try_files \$uri \$uri/ =404;
|
||||
try_files \$uri \$uri/ /index.php\$is_args\$args;
|
||||
#try_files \$uri \$uri/ \$uri.html \$uri.php\$is_args\$query_string;
|
||||
#try_files $uri $uri/ =404;
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
#try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
|
||||
}
|
||||
|
||||
location = /favicon.ico { log_not_found off; access_log off; }
|
||||
location = /robots.txt { log_not_found off; access_log off; allow all; }
|
||||
location ~* \.(css|gif|ico|jpeg|jpg|js|png|svg|webp|eot|otf|woff|woff2|ttf|ogg)\$ {
|
||||
location ~* \.(css|gif|ico|jpeg|jpg|js|png|svg|webp|eot|otf|woff|woff2|ttf|ogg)$ {
|
||||
expires max;
|
||||
log_not_found off;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
location ~ \.php\$ {
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/var/run/php/php${phpver}-fpm.sock;
|
||||
fastcgi_pass unix:/var/run/php/phpPHPVER-fpm.sock;
|
||||
#fastcgi_cache MYAPP;
|
||||
#fastcgi_cache_valid 200 302 301 1m;
|
||||
#fastcgi_cache_valid 404 1m;
|
||||
#fastcgi_cache_bypass \$no_cache;
|
||||
#fastcgi_no_cache \$no_cache;
|
||||
#fastcgi_cache_bypass $no_cache;
|
||||
#fastcgi_no_cache $no_cache;
|
||||
#fastcgi_cache_revalidate on;
|
||||
#fastcgi_cache_background_update on;
|
||||
#fastcgi_cache_lock on;
|
||||
@@ -74,28 +73,25 @@ server {
|
||||
}
|
||||
|
||||
#Cache everything by default
|
||||
set \$no_cache 0;
|
||||
set $no_cache 0;
|
||||
|
||||
#Don't cache POST requests
|
||||
if (\$request_method = POST) {
|
||||
set \$no_cache 1;
|
||||
if ($request_method = POST) {
|
||||
set $no_cache 1;
|
||||
}
|
||||
|
||||
#Don't cache if the URL contains a query string
|
||||
if (\$query_string != "") {
|
||||
set \$no_cache 1;
|
||||
if ($query_string != "") {
|
||||
set $no_cache 1;
|
||||
}
|
||||
|
||||
#Don't cache the following URLs
|
||||
if (\$request_uri ~* "/(administrator/|login.php)") {
|
||||
set \$no_cache 1;
|
||||
if ($request_uri ~* "/(administrator/|login.php)") {
|
||||
set $no_cache 1;
|
||||
}
|
||||
|
||||
#Don't cache if there is a cookie called PHPSESSID
|
||||
if (\$http_cookie = "PHPSESSID") {
|
||||
set \$no_cache 1;
|
||||
if ($http_cookie = "PHPSESSID") {
|
||||
set $no_cache 1;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
ln -s /etc/nginx/sites-available/"$domain" /etc/nginx/sites-enabled/
|
||||
}
|
||||
Reference in New Issue
Block a user