Skip to content

Настройка веб сервера

andchir edited this page Nov 16, 2019 · 8 revisions

Пример конфигурации для Nginx:

server {
    listen 80;

    server_name shopkeeper4;
    root /var/www/shopkeeper4/public;

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/(index|check)\.php(/|$) {
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        internal;
    }
    
    location ~ \.php$ {
        return 404;
    }
    
    location = /favicon.ico {
	log_not_found off;
	access_log off;
    }

    location = /robots.txt {
	allow all;
	log_not_found off;
	access_log off;
    }

    location ~ /\. {
	deny all;
    }

    error_log /var/log/nginx/shopkeeper4_error.log;
    access_log /var/log/nginx/shopkeeper4_access.log;
}

Пример содержимого файла .htaccess для сервера Apache:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 302 ^/$ /index.php/
    </IfModule>
</IfModule>

Дополнительные материалы

Clone this wiki locally
You can’t perform that action at this time.