Темплейт nginx для Xenforo (VestaCP)

mygedz

Администратор
Сообщения
588
Оценка реакций
62
xenforo.tpl
NGINX:
server {
    listen      %ip%:%web_port%;
    server_name %domain_idn% %alias_idn%;
    root        %docroot%;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    if ($host != %domain_idn%) {
    return 301 https://%domain_idn%$request_uri;
    }
 
    location / {
        return 301 https://%domain_idn%$request_uri;
    }
 
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }

    include     %home%/%user%/conf/web/nginx.%domain_idn%.conf*;
}
xenforo.stpl
NGINX:
server {
    listen      %ip%:%web_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;
    root        %sdocroot%;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/%domain%.log combined;
    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
    error_log   /var/log/nginx/domains/%domain%.error.log error;

    ssl         on;
    ssl_certificate      %ssl_pem%;
    ssl_certificate_key  %ssl_key%;

    if ($host != %domain_idn%) {
    return 301 https://%domain_idn%$request_uri;
    }
 
    location / {
        try_files $uri $uri/ /index.php?$uri&$args;
    }
 
    location ~ /(internal_data|library)/ {
         internal;
    }
 
    location ~ \.php$ {
        try_files $uri = 404;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass    %backend_lsnr%;
        fastcgi_index   index.php;
        include         /etc/nginx/fastcgi_params;        
            }
         
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   %home%/%user%/web/%domain%/document_errors/;
    }


    include     %home%/%user%/conf/web/snginx.%domain_idn%.conf*;
}
Все остальное делается через инклуды, например
snginx.%domain_idn%.conf_install
NGINX:
    location /install/ {
            allow 127.0.0.1;
            allow 192.168.0.1;
            deny all;
             
                location ~ \.php$ {
                try_files $uri = 404;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass    %backend_lsnr%;
                fastcgi_index   index.php;
                include         /etc/nginx/fastcgi_params;
                }
    }
 
Последнее редактирование:
Верх Низ