Im Folgenden sehen Sie eine Beispiel-NGNIX-Konfiguration für VIMP. Wir gehen im Folgenden davon aus, dass NGINX bereits läuft und PHP-Dateien ausgeliefert werden können.
Erstellen Sie dann eine neue NGINX Serverkonfiguration unter /etc/nginx/sites-enabled (z.B. vimp.conf) bzw. bearbeiten Sie alternativ Ihre bestehende Default-Konfiguration.
Die NGINX-Konfiguration für VIMP muss folgendermaßen aussehen (ersetzen Sie dabei das Root-Verzeichnis, die php-fpm-Version sowie den Servernamen und die Log-Verzeichnisse entsprechend Ihrer Serverkonfiguration):
server { rewrite_log off; listen 80; listen [::]:80 ipv6only=on; # replace /var/www/vimp/ with your actual VIMP installation folder path in the following line root /var/www/vimp/web; # replace your_servername with your actual server name in the following line server_name your_servername; # replace /var/www/vimp/ with your actual VIMP installation folder path in the following lines access_log /var/www/logs/vimp_nginx_access.log; error_log /var/www/logs/vimp_nginx_error.log warn; add_header Access-Control-Allow-Origin * always; index index.php frontend.php webtv.php backend.php frontend_dev.php webtv_dev.php backend_dev.php restoreProgress.php updateProgress.php index.html; charset utf-8; server_tokens off; client_max_body_size 500M; # Disable access log for favicon.ico location = /favicon.ico { log_not_found off; access_log off; } # Disable access log for robots.txt location = /robots.txt { allow all; log_not_found off; access_log off; } # Prevent access to files/folders which starts with a dot location ~ /\. { deny all; access_log off; log_not_found off; } # Directive for dynamic JS files which are processed by PHP location ~ ^/(.+)\.js\.php(/|$) { error_page 417 = @appwebtv; error_page 418 = @appfrontend; error_page 419 = @appbackend; if ( $query_string ~ "app=webtv" ) { return 417; } if ( $query_string ~ "app=frontend" ) { return 418; } if ( $query_string ~ "app=backend" ) { return 419; } return 418 } # Directive for dynamic JS files which are processed by PHP location @appfrontend { index index.php; #include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_buffers 32 256k; fastcgi_buffer_size 512k; fastcgi_busy_buffers_size 512k; fastcgi_param HTTPS off; try_files $uri $uri/ /index.php$is_args$query_string; } # Directive for dynamic JS files which are processed by PHP (no longer needed for VIMP 5.1 and higher) location @appwebtv { index webtv.php; #include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_buffers 32 256k; fastcgi_buffer_size 512k; fastcgi_busy_buffers_size 512k; fastcgi_param HTTPS off; try_files $uri $uri/ /webtv.php$is_args$query_string; } # Directive for dynamic JS files which are processed by PHP location @appbackend { index backend.php; #include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_buffers 32 256k; fastcgi_buffer_size 512k; fastcgi_busy_buffers_size 512k; fastcgi_param HTTPS off; try_files $uri $uri/ /backend.php$is_args$query_string; } # All front controllers for vimp location ~ ^/(index|frontend_dev|frontend_cache|backend|backend_dev|backend_cache|getMedia|health|webtv|webtv_dev|webtv_cache|restoreProgress|updateProgress|js/jsdeliverer)\.php(/|$) { #include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; #fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_buffers 32 256k; fastcgi_buffer_size 512k; fastcgi_busy_buffers_size 512k; fastcgi_param HTTPS off; } location @jsdeliverer { index js/jsdeliverer.php; try_files _ /js/jsdeliverer.php$is_args$query_string; } location /js { rewrite ^/js/$ /js/*.js; if (!-e $request_filename) { error_page 420 = @jsdeliverer; return 420; } } # Try to serve file directly, fallback to rewrite to default frontend controller location / { index index.php; try_files $uri $uri/ @rewriteapp; } # Rewrite fallback to index.php location @rewriteapp { rewrite ^(.*)$ /index.php$1 last; } }
Hinweis: Achten Sie darauf, fastcgi_param HTTPS auf "on" zu setzen, wenn Sie Ihre Website unter https betreiben!