nginx -s reload
Лог доступа
access_log /var/log/nginx/имяФайла_access.log;
Лог ошибок
error_log /var/log/nginx/имяФайла_eroor.log;
Больше логов
error_log /var/log/nginx/имяФайла.log debug;
отключить логи
access_log off;
error_log off;
vi /etc/nginx/sites-enabled/mlp.in.ua
server {
listen 80;
server_name www.mlp.in.ua, mlp.pp.ua;
root /var/www/mlp.pp.ua;
index index.php, index.html;
access_log /var/log/nginx/mail.mlp.in.ua_access.log;
error_log /var/log/nginx/mail.mlp.in.ua_error.log;
location / {
try_files $uri $uri/ =404;
}
}
chown -R www-data:www-data /var/www/mlp.pp.ua
ln -s /etc/nginx/sites-enabled/mail.mlp.in.ua /etc/nginx/sites-enabled/
nginx -s reload
vi /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/mlp.pp.ua;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
set $root_path /var/www/mlp.pp.ua;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;
include fastcgi_params;
fastcgi_param DOCUMENT_ROOT $root_path;
}
}
apt install php php-fpm
systemctl restart php8.2-fpm.service
vi /var/www/html/index.php
<?php phpinfo(); ?>
Создали пользователя user01
apt install apache2-utils -y
htpasswd -c /etc/nginx/.htpasswd user01
включим аутентификацию в nginx
server {
listen 80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
auth_basic "Restricted Access";
auth_basic_user_file /etc/nginx/.htpasswd;
# Остальная конфигурация вашего сайта
}
}