Hello Team,
Can Cockpit v2 be used with Nginx. Since .htaccess does not work in nginx, do I need to make any additional changes?
Best regards
JB
Hello Team,
Can Cockpit v2 be used with Nginx. Since .htaccess does not work in nginx, do I need to make any additional changes?
Best regards
JB
Hi
Nginx should of course work. Yo can use any common config template for a php based application. Google will give you many options here.
Greets
Artur
Hi Artur,
Thanks a lot. It works. I found one working example.
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com/html;
access_log /var/log/nginx/example.com-access.log;
error_log /var/log/nginx/example.com-error.log error;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
# fastcgi_index index.php;
}
# enable browser caching
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|webp)$ {
expires 1y;
log_not_found off;
}
location ~ /\.ht {
deny all;
}
# deny direct access to files
location ~ .sqlite$ {
deny all;
}
location ~ .yaml$ {
deny all;
}
location ~ /\.git {
deny all;
}
}