Skip to content
d47081 edited this page Feb 13, 2024 · 1 revision

Domain

server {

	listen 80;

	root /home/kvazar/webapp/public;

	index index.html index.htm index.nginx-debian.html index.php;

	server_name kvazar.ygg kvazar.ygg.at;

	location / {

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

	location ~ ^/index\.php(/|$) {

		fastcgi_param APP_ENV prod;

		include snippets/fastcgi-php.conf;

		fastcgi_pass unix:/run/php/php8.2-fpm.sock;

		fastcgi_split_path_info ^(.+\.php)(/.*)$;

		fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param DOCUMENT_ROOT $realpath_root;

		internal;
	}

	location ~ \.php$ {
		return 404;
	}
}

Subfolder

server {

	listen 80;

	server_name _;

	location /kvazar {
		root /home/kvazar/webapp/public;
		rewrite ^/kvazar/(.*)$ /$1 break;
		try_files $uri @kvazar;
	}
	
	location @kvazar {
		fastcgi_pass unix:/run/php/php8.2-fpm.sock;

		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME /home/kvazar/webapp/public/index.php;
		fastcgi_param SCRIPT_NAME /kvazar/index.php;
		fastcgi_param REQUEST_URI /kvazar$uri?$args;

		# Environment variables
		fastcgi_param APP_ENV prod;
	}
}
Clone this wiki locally