Технические требования
Движок для сайта (CMS) Fast Site Engine является крайне неприхотливым, безопасным, быстрым, SEO оптимизированным и будет гарантированно работать на любом хостинге.Поскольку движок(CMS) не использует базу данных для хранения информации и не имеет закодированных в байт код участков,- перенос сайта с хостинга на хостинг является простым копированием файлов, без необходимости переноса и настройки БД и прочих возможных проблем с несовместимостью софта..
- Не по теме: по состоянию на 28.08.2017 Яндекс Маркет не берёт домены .pф
Требования к программной конфигурации веб-сервера
- Linux/Unix-сервер (CentOS, Debian итп. 64 bit).
- Ngnix или Apache, или Ngnix+Apache.
PHP 5.4 (вышел в 2012)PHP 7.3 (из-за глобальных изменений политики безопасности в сети, связанной с cookie) и старше (последнее тестирование движок(CMS) прошёл в PHP 8).- PHP расширения:
mbstring - обязательно.
bcmath - обязательно для операций с деньгами (интернет магазины).
zip - опционально для раздела бэкапа и возможности архивирования в файловом менеджере. - От 2 Мб места на диске. Движок(CMS) весит 1.8 Мб (без панели управления 295 Кб)
При отсутствие обработчика .htaccess у сервера Ngnix следует прописать настройку mod_rewrite итп. см. ниже.
Необходимо отметить, что Apache стоит на подавляющей части серверов и потихоньку теряет свою популярность, в связи с прожорливостью к ресурсам. Всё чаще связки Ngnix+Apache в которых Ngnix обычно отдаёт статические фалы и передаёт PHP запросы Apache.
Ngnix используют для высоко нагруженных проектов и/или чтоб сэкономить ресурсы сервера. (У части движков это затруднительно, поскольку .htaccess раскидан по многим директориям.
Пример конфигурации Ngnix вместе с PHP-FPM на сервере под управлением Brainy (27.12.2019)
1) В php.ini
# постоянная проверка
opcache.revalidate_freq = 0
2) Можно индивидуально включить сжатие передаваемой информации (в Brainy - Оптимизация работы сайта), но я это делаю на весь сервер сразу:Установка вебсервера - Редактировать конфигурацию nginx
# Кое-какие манипуляции с логами error_log /var/log/nginx/error.log crit; # access_log /var/log/nginx/access.log main; access_log off; # Включаем компрессию gzip on; gzip_comp_level 5; gzip_min_length 256; gzip_proxied any; gzip_vary on; gzip_types text/plain text/css application/json application/x-javascript application/xml text/javascript application/javascript; # Отключаем кэширование и игнор заголовков, это приводит к проблемам с отдачей страниц proxy_cache_valid 0; #proxy_cache_valid 10s; # proxy_ignore_headers Expires Cache-Control; # fastcgi_ignore_headers Expires Cache-Control;3) Оптимизация работы сайта
4) Индивидуальная донастройка виртхостов - Редактировать nginx
Нижнее поле заполняем:
/etc/brainy/data/webserver_config/user_includes/fsen/fsen.ru_location.nginx
index index.php index.html index.htm;
location ~ /deny/ {
deny all;
}
location ~ /inc/tpl/inc/ {
deny all;
}
location ~* \.(jpg|gif|png|svg|ico|css|js|woff|eot)$ {
access_log off;
add_header Expires "A3600";
add_header Cache-Control "must-revalidate, public, max-age=3600";
add_header Strict-Transport-Security "max-age=604800";
# Замена несуществующих картинок, полезно в интернет магазинах.
#location ~* /inc/img/.+\.jpg$ {
# log_not_found off;
# try_files $uri /inc/no.gif;
#}
}
try_files $uri $uri/ /index.php?q=$uri&$args;
И вот что мы получаем на выходе:
/etc/nginx/nginx.conf - его редактируем в панели управления в "Установка вебсервера".
user nginx nginx;
worker_processes 2;
pcre_jit on;
error_log /var/log/nginx/error.log crit;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'
'cs=$upstream_cache_status';
charset utf-8;
#access_log /var/log/nginx/access.log main;
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
reset_timedout_connection on;
keepalive_timeout 60;
server_tokens off;
server_names_hash_max_size 128;
server_names_hash_bucket_size 256;
client_header_timeout 15m;
client_body_timeout 15m;
send_timeout 15m;
client_max_body_size 700m;
connection_pool_size 256;
client_body_buffer_size 1024k;
client_header_buffer_size 8k;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript application/xml text/javascript application/javascript;
#proxy_temp_path /var/lib/nginx/proxy 1 2;
#proxy_cache_valid 20s;
#proxy_cache_key $scheme$proxy_host$request_uri$cookie_user;
#proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:400m inactive=120m max_size=500M;
#proxy_cache_min_uses 2;
proxy_cache_valid 0;
proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=one:100m max_size=300M;
proxy_cache_path /var/lib/nginx/cache1 levels=1:2 keys_zone=two:100m max_size=300M;
proxy_temp_path /var/lib/nginx/proxy 1 2;
#proxy_ignore_headers Expires Cache-Control;
proxy_cache_use_stale error timeout invalid_header http_502;
proxy_cache_bypass $cookie_session;
proxy_no_cache $cookie_session;
proxy_cache_min_uses 2;
limit_conn_zone $binary_remote_addr zone=lone:10m;
limit_req_zone $binary_remote_addr zone=ltwo:10m rate=5r/s;
limit_req_zone $binary_remote_addr zone=lstrict:10m rate=1r/s;
limit_req_zone $binary_remote_addr zone=highspeed:10m rate=10r/s;
fastcgi_cache_path /var/lib/nginx/fpm levels=1:2 keys_zone=fcgi:32m max_size=100m;
fastcgi_cache_path /var/lib/nginx/fpm2 levels=1:2 keys_zone=fcgi2:32m max_size=100m;
# fastcgi_cache_key "$scheme$request_method$host$request_uri$cookie_user";
fastcgi_temp_path /var/lib/nginx/fastcgi 1 2;
#fastcgi_ignore_headers Expires Cache-Control;
fastcgi_cache_use_stale error timeout invalid_header;
# fastcgi_param PHP_ADMIN_VALUE "display_errors=off";
limit_conn_zone $binary_remote_addr zone=lfcgi:10m;
limit_req_zone $binary_remote_addr zone=lfsci2:10m rate=5r/s;
resolver 8.8.8.8 8.8.4.4 valid=300s ipv6=off;
resolver_timeout 5s;
map $http_accept $webp_suffix {
"~*webp" ".webp";
}
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
ModSecurityEnabled off;
ModSecurityConfig modsecurity.conf;
include /etc/nginx/conf.d/*.conf;
index index.php index.html index.htm;
server {
root /var/www/html;
access_log /etc/nginx/vhost_logs/default_access;
error_log /etc/nginx/vhost_logs/default_error;
location / {
root /var/www/html;
index index.php index.html index.htm;
}
}
include /etc/nginx/sites-available/*.conf;
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# root html;
# location / {
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# root html;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# }
#}
}
Сгенерируется такой конфиг
/etc/nginx/sites-available/fsen.ru.conf
server {
listen 00.00.00.00:80;
server_name fsen.ru www.fsen.ru;
root /home/fsen/sites/fsen.ru;
access_log /etc/nginx/vhost_logs/fsen.ru_access;
error_log /etc/nginx/vhost_logs/fsen.ru_error;
location ~ /.well-known { allow all; }
# location ~* robots.txt { root /etc/nginx; }
location ~ /\.ht {
deny all;
access_log off;
log_not_found off;
}
location / {
root /home/fsen/sites/fsen.ru;
include /etc/brainy/data/webserver_config/user_includes/fsen/fsen.ru_location.nginx;
}
location ~ \.php$ {
try_files $fastcgi_script_name =404;
root /home/fsen/sites/fsen.ru;
#fastcgi_pass localhost:9010;
fastcgi_pass unix:/var/run/php-fpm/php73w-fsen.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/fsen/sites/fsen.ru$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /home/fsen/sites/fsen.ru$fastcgi_script_name;
fastcgi_buffers 8 64k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_connect_timeout 120;
fastcgi_read_timeout 900;
fastcgi_send_timeout 900;
fastcgi_cache off;
fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
fastcgi_cache_valid 200 10s;
limit_conn lfcgi 50;
#fastcgi_param SCRIPT_FILENAME /sites/fsen.ru$fastcgi_script_name;
#fastcgi_param PATH_TRANSLATED /sites/fsen.ru$fastcgi_script_name;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
}
# error_page 404 /404.html;
# location = /40x.html {
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
}
И такой конфиг для https
/etc/nginx/sites-available/ssl.fsen.ru.conf
server {
listen 00.00.00.00:443 ssl http2;
server_name fsen.ru www.fsen.ru;
root /home/fsen/sites/fsen.ru;
# ssl on;
ssl_certificate /etc/certs/fsen/fsen.ru_00-00-0000 00:00:00_letencrypt.crt_v2;
ssl_certificate_key /etc/certs/fsen/fsen.ru_00-00-0000 00:00:00_letencrypt.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers "HIGH:!RC4:!aNULL:!MD5:!kEDH";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security 'max-age=604800';
access_log /etc/nginx/vhost_logs/fsen.ru_access;
error_log /etc/nginx/vhost_logs/fsen.ru_error;
location ~ /.well-known { allow all; }
# location ~* robots.txt { root /etc/nginx; }
location ~ /\.ht {
deny all;
access_log off;
log_not_found off;
}
location / {
root /home/fsen/sites/fsen.ru;
include /etc/brainy/data/webserver_config/user_includes/fsen/fsen.ru_location.nginx;
}
location ~ \.php$ {
try_files $fastcgi_script_name =404;
root /home/fsen/sites/fsen.ru;
#fastcgi_pass localhost:9010;
fastcgi_pass unix:/var/run/php-fpm/php73w-fsen.sock;
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/fsen/sites/fsen.ru$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /home/fsen/sites/fsen.ru$fastcgi_script_name;
fastcgi_buffers 8 64k;
fastcgi_buffer_size 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_connect_timeout 120;
fastcgi_read_timeout 900;
fastcgi_send_timeout 900;
fastcgi_cache off;
fastcgi_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
fastcgi_cache_valid 200 10s;
limit_conn lfcgi 50;
#fastcgi_param SCRIPT_FILENAME /sites/fsen.ru$fastcgi_script_name;
#fastcgi_param PATH_TRANSLATED /sites/fsen.ru$fastcgi_script_name;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
}
# error_page 404 /404.html;
# location = /40x.html {
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
}
Ниже устаревшее
Пример конфигурации Ngnix вместе с PHP-FPM:
server {
listen 80;
server_name fsen.ru www.fsen.ru;
root /var/www/fsen.ru;
index index.php;
location /inc/tpl/inc/ {
deny all;
}
location / {
if (!-e $request_filename) {
rewrite ^(/.*)$ /index.php?q=$1 last;
}
}
location ~* \.php$ {
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/fsen.ru$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
include fastcgi_params;
}
}
Пример конфигурации Ngnix дублирующий .htaccess вместе с php-farm без include fastcgi_params:
server {
listen 80;
server_name fsen.ru www.fsen.ru;
root /var/www/fsen.ru;
index index.php;
location ~* \.(css|js|gif|jpg|jpeg|ico|swf)$ { # В кэш браузера графику и прочее на час
expires 1h;
add_header Last-Modified: $date_gmt;
add_header Cache-Control private;
}
location /inc/tpl/inc/ {
deny all;
}
location / {
if (!-e $request_filename) {
rewrite ^(/.*)$ /index.php?q=$1 last;
break;
}
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/fsen.ru$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
proxy_set_header HTTP_COOKIE $http_cookie;
}
}