server {
listen 80;
listen [::]:80;
server_name sharpsss.ru www.sharpsss.ru;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sharpsss.ru www.sharpsss.ru;
ssl_certificate /etc/letsencrypt/live/sharpsss.ru/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sharpsss.ru/privkey.pem; # managed by Certbot
# Указываем корневой каталог для Laravel
root /var/www/cms_prod/app_api/public;
index index.php index.html index.htm;
# Для PHP
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Перенаправляем все запросы на front controller Laravel
location / {
try_files $uri $uri/ /index.php?$query_string;
}
}