Files
DockerTemplates/PHP/nginx.conf
Primož Pokeržnik 186b09e37e Add PHP
2024-05-15 10:53:46 +02:00

29 lines
712 B
Nginx Configuration File

server {
listen 80 default_server;
server_name localhost;
root /var/www/html;
index index.php index.html;
# Support Yii2 pretty URL routing
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename){
rewrite ^/(.*) /index.php?r=$1 last;
}
}
location ~* \.php$ {
fastcgi_pass php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# Prevent additional headers like TRACE, DELETE, PUSH
if ($request_method !~ ^(GET|HEAD|POST)$ )
{
return 405;
}
}