server {
listen [мой_ip]:443 ssl http2;
server_name [мойдомен] www.[мойдомен];
root /home/admin/web/[мойдомен]/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/[мойдомен].log combined;
access_log /var/log/nginx/domains/[мойдомен].bytes bytes;
error_log /var/log/nginx/domains/[мойдомен].error.log error;
ssl_certificate /home/admin/conf/web/[мойдомен]/ssl/[мойдомен].pem;
ssl_certificate_key /home/admin/conf/web/[мойдомен]/ssl/[мойдомен].key;
ssl_stapling on;
ssl_stapling_verify on;
include /home/admin/conf/web/[мойдомен]/nginx.hsts.conf*;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
fastcgi_hide_header "Set-Cookie";
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass unix:/run/php/php7.3-fpm-[мойдомен].sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
# WebP Express rules
# --------------------
location ~* ^/?wp-content/.*\.(png|jpe?g)$ {
add_header Vary Accept;
expires 365d;
if ($http_accept !~* "webp"){
break;
}
try_files
/wp-content/webp-express/webp-images/doc-root/$uri.webp
$uri.webp
/wp-content/plugins/webp-express/wod/webp-on-demand.php?xsource=x$request_filename&wp-content=wp-content
;
}
# Route requests for non-existing webps to the converter
location ~* ^/?wp-content/.*\.(png|jpe?g)\.webp$ {
try_files
$uri
/wp-content/plugins/webp-express/wod/webp-realizer.php?xdestination=x$request_filename&wp-content=wp-content
;
}
# ------------------- (WebP Express rules ends here)
location /error/ {
alias /home/admin/web/[мойдомен]/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/admin/web/[мойдомен]/stats/;
include /home/admin/web/[мойдомен]/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/admin/conf/web/[мойдомен]/nginx.ssl.conf_*;
include /home/admin/web/[мойдомен]/public_html/*.conf*;
}
наверно и жесткий раз в 10 больше, чем нужно? )
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}