Shopware 4.3.0 auf Plesk 11.5 + Nginx 1.5.0

Moin Moin. Ich habe ein etwas blödes Problem. Aktuell bin ich am testen in wie fern Shopware bei uns zum Einsatz kommen soll. Shopware 4.3.0 ist installiert und läuft! Möchte ich nun umstellen auf nginx (1.5.0) mit php-fpm (5.3.10) über Plesk dann wirft er klar erstmal eine Bad Gateway Meldung aus. Nun habe ich sämtlich Konstellationen der nginx Variablen in Plesk getrümmert und probiert. Nur leider verweigert Plesk jede der configs die hier angeboten wurden (inkl. der aus dem Git). Als Fehlermeldung erhalte ich folgende Zeile. Ungültige Nginx-Konfiguration: nginx: [emerg] no port in upstream “php-fpm” in /var/www/vhosts/system/sw.xxxxxxxx.de/conf/vhost_nginx.conf:132 nginx: configuration file /etc/nginx/nginx.conf test failed Auf dem Server laufen noch andere Seiten welche über nginx bedient werden und alle haben ihre eigene config, von daher nginx spinnt meiner Meinung nach nicht rum. Kann es irgendwie damit zusammenhängen das Plesk da mal wieder etwas stört oder eine Variable nicht versteht oder verstehen will? Hier nochmal Eckdaten: Plesk 11.5.30 nginx 1.5.0 PHP 5.3.10 (fpm) Ubuntu 12.04 LTS Dedicated Server (Strato) Falls noch etwas an Input gebraucht wird dann immer her mit den Fragen :wink: Jeder Denkanstoss ist willkommen!

Bekomme den gleich Fehler. Hat jemand eine Lösung?

Wie ist denn deine aktuelle nginx Konfigration für den vhost ? Was schmeisst nginx -t für einen Fehler aus ?

Momentan siehts wie folgt aus: ## Author: Benjamin Cremer ## Shopware 4 nginx rules. ## Heavily Inspired by https://github.com/perusio/drupal-with-nginx/ ## Designed to be included in any server {} block. ## https://github.com/bcremer/shopware-with-nginx location = /favicon.ico { log\_not\_found off; access\_log off; } location = /robots.txt { allow all; log\_not\_found off; access\_log off; } location = /templates/\_default/backend/\_resources/resources/css/icon-set.css { gzip off; } ## Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS\_Store (Mac). location ~ /\. { deny all; access\_log off; log\_not\_found off; } ## Deny all attems to access possible configuration files location ~ \.(tpl|yml|ini)$ { deny all; } ## Deny access to media upload folder location ^~ /media/temp/ { deny all; } location ^~ /cache/ { deny all; } location ^~ /files/documents/ { deny all; } # Breaks backend/media/ rewrite # #location ~ /(engine|files|templates|media)/ { # location ~ \.php$ { # return 403; # } #} location /check/ { index index.php; try\_files $uri /check/index.php?$args; } # Shopware \>= 4.3 unstall / update location /recovery/install { index index.php; try\_files $uri /recovery/install/index.php?$args; } location /recovery/update { index index.php; try\_files $uri /recovery/update/index.php?$args; } # Shopware \< 4.3 install / update location /install { index index.php; try\_files $uri /install/index.php?$args; } location /update { index index.php; try\_files $uri /update/index.php?$args; } index shopware.php index.php; try\_files $uri $uri/ /shopware.php?$args; ## XML Sitemap support. location = /sitemap.xml { try\_files $uri /shopware.php?controller=SitemapXml; } location ~ \.php$ { try\_files $uri $uri/ =404; ## NOTE: You should have "cgi.fix\_pathinfo = 0;" in php.ini fastcgi\_split\_path\_info ^(.+\.php)(/.+)$; ## required for upstream keepalive # disabled due to failed connections #fastcgi\_keep\_conn on; include fastcgi\_params; fastcgi\_buffers 8 16k; fastcgi\_buffer\_size 32k; client\_max\_body\_size 24M; client\_body\_buffer\_size 128k; } gzip on; gzip\_proxied any; gzip\_types text/plain text/xml text/css application/x-javascript text/js text/javascript; gzip\_vary on; gzip\_disable "MSIE [1-6]\.(?!.\*SV1)"; proxy\_read\_timeout 300; Dabei habe ich aus dem letztem block "location ~ .php$ " die Zeile: fastcgi\_pass php-fpm; rausgemacht. Diese verursacht den Fehler.

Was schmeisst nginx -t für einen Fehler aus ? Versuche einmal die folgende Konfiguration: https://hostianer.de/shopware-hosting-mit-nginx/

Vielen Dank für deine Antwort. Aus diesem Code bin ich gezwungen client\_max\_body\_size 100M; location / { wegzumachen. Danach kommt “403 Forbidden”. Außerdem ist anzumerken das Plesk benutzt wird und die Einstellungen nichteinmal gespeichert werden sobald der Code falsch ist. Dieser wird in Backend angegeben und nich im Dateisystem.

Ansonsten musst du einmal im Plesk Forum nachfragen, mit Plesk kenne ich mich leider überhaupt nicht aus.

Hallo, könntest du hier nochmal die gesamte nginx configuration posten? Zur Erklärung: Die shopware.conf ist nur ein Teil der Konfiguration. Die gesamt Konfiguration besteht grob aus 3 teilen: nginx.conf [list] - Nginx konfiguration (Hier werden u.A die upstreams zu php-fpm definiert) - VHost konfiguration - Inkludierte shopware konfiguration [/list] Allgemein bleibt mir noch zu sagen, dass die Verwendung von Nginx statt Apache Shopware nicht auf magische Weise schneller macht. Ein sinnvoll konfigurierter Apache ist in den meißten fällen genau so schnell wie Nginx. Das größte Performanceloch bei großen Webapplikationen ist die Datenbank. Wichtiger ist den MySQL vernünftig zu konfigurieren, z.B die innodb_buffer_pool_size so hoch zu schrauben, dass das die Gesamte Datenbank in den Speicher geladen wird. Viele Grüße, Benjamin Cremer :shopware:

So ganz stimmt das nicht mit der Geschwindigkeit :slight_smile: NGINX hat hier definitiv einen Vorteil, vor allem natürlich auch bei Hochlast hat nginx klar die Nase vorn und auch beim abarbeiten der Requests. Wenn die Seite oder natürlich auch bspw der MySQL Server schlecht konfiguriert und optimiert sind, hilft natürlich auch ein nginx nichts, dass stimmt. :slight_smile: Aber nochmals: Was schmeisst nginx -t für einen Fehler aus ? Was steht im nginx Error log ? Was steht im php-fpm Error log ? Was steht im Webseiten log ?

Du hast in location ~ \.php$ { try\_files $uri $uri/ =404; ## NOTE: You should have "cgi.fix\_pathinfo = 0;" in php.ini fastcgi\_split\_path\_info ^(.+\.php)(/.+)$; ## required for upstream keepalive # disabled due to failed connections #fastcgi\_keep\_conn on; include fastcgi\_params; fastcgi\_buffers 8 16k; fastcgi\_buffer\_size 32k; client\_max\_body\_size 24M; client\_body\_buffer\_size 128k; } überhaupt nicht definiert, wie sich nginx mit PHP-FPM verbinden soll. Dort fehlt die fastcgi_pass-Direktive (s. http://wiki.nginx.org/HttpFcgiModule#fastcgi_pass), wo Du entweder einen Socket, einen Port oder einen Upstream-Block angeben mußt. In der Anleitung von Herrn Cremer (s. https://github.com/bcremer/shopware-wit … nginx.conf und https://github.com/bcremer/shopware-wit … pware.conf) ist das so auch drin - muß Du nochmal vergleichen. [quote]Allgemein bleibt mir noch zu sagen, dass die Verwendung von Nginx statt Apache Shopware nicht auf magische Weise schneller macht. Ein sinnvoll konfigurierter Apache ist in den meißten fällen genau so schnell wie Nginx.[/quote] Würde ich so nicht unterschreiben. Wenn MySQL und PHP performancetechnisch richtig konfiguriert sind, ist nginx schon deutlich schneller. Und gerade bei vielen Requests fängt der Apache an, Arbeitsspeicher zu “fressen” - das kann ein Problem werden, wenn der Server damit nicht üppig ausgestattet ist.

Hier die funktionierende Config für “echtes” nginx Hosting unter Plesk Verwende mal folgende Config (“Intelligente Bearbeitung statischer Dateien” einschalten, “Statische Dateien direkt durch Nginx bedienen” aus, “PHP von Nginx verarbeiten lassen” ein. location = / { index index.html index.php shopware.php; rewrite shopware.dll /shopware.php; rewrite files/documents/.* /engine last; rewrite backend/media/(.*) /media/$1 last; if (!-e $request_filename){ rewrite . /shopware.php last; } } # Shopware >= 4.3 install / update location /recovery/install { index index.php; try_files $uri /recovery/install/index.php?$args; } location /recovery/update { index index.php; try_files $uri /recovery/update/index.php?args; } location = /favicon.ico { log\_not\_found off; access\_log off; } location = /templates/\_default/backend/\_resources/resources/css/icon-set.css { gzip off; } ## Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS\_Store (Mac). location ~ /\. { deny all; access\_log off; log\_not\_found off; } ## Deny all attems to access possible configuration files location ~ \.(tpl|yml|ini|log) { deny all; } ## Deny access to media upload folder location ^~ /media/temp/ { deny all; } location ^~ /cache/ { deny all; } location ^~ /files/documents/ { deny all; } # Block direct access to ESDs, but allow the follwing download options: # * ‘PHP’ (slow) # * ‘X-Accel’ (optimized) # Also see http://wiki.shopware.com/ESD_detail_111 … ware_4.2.2 location ^~ /files/552211cce724117c3178e3d22bec532ec/ { internal; } # Breaks backend/media/ rewrite # #location ~ /(engine|files|templates|media)/ { # location ~ .php$ { # return 403; # } #} location ~* “^/themes/Frontend/Responsive/frontend/_public/vendors/fonts/open-sans-fontface/(?:.+).(?:ttf|eot|svg|woff)" { expires max; add\_header Cache-Control "public"; access\_log off; log\_not\_found off; } location ~\* "^/themes/Frontend/Responsive/frontend/\_public/src/fonts/(?:.+)\.(?:ttf|eot|svg|woff)” { expires max; add_header Cache-Control “public”; access_log off; log_not_found off; } location ~* "^/web/cache/(?:[0-9]{10})_(?:.+).(?:js|css)" { expires max; add\_header Cache-Control "public"; access\_log off; log\_not\_found off; } ## All static files will be served directly. location ~\* ^.+\.(?:css|cur|js|jpe?g|gif|ico|png|html|xml|pdf) { ## Defining rewrite rules rewrite files/documents/.* /engine last; rewrite backend/media/(.*) /media/$1 last; expires 1w; add_header Cache-Control “public, must-revalidate, proxy-revalidate”; access_log off; # The directive enables or disables messages in error_log about files not found on disk. log_not_found off; tcp_nodelay off; ## Set the OS file cache. open_file_cache max=3000 inactive=120s; open_file_cache_valid 45s; open_file_cache_min_uses 2; open_file_cache_errors off; ## Fallback to shopware ## comment in if needed #try_files $uri @shopware; } ## XML Sitemap support. location = /sitemap.xml { log_not_found off; access_log off; try_files uri @shopware; } ## robots.txt support. location = /robots.txt { log\_not\_found off; access\_log off; } #location @shopware { # rewrite / /shopware.php; #} location ~ \.php { try_files $uri $uri/ =404; } location ~ /(engine|images/[a-z]+|files|templates)/ { rewrite files/documents/.* /engine last; } if (!-e request\_filename){ rewrite ^(.\*) /shopware.php break; }

Hey  AIXPRO ,

Habt ihr vileicht auch eine Nginx config für Shopware 5.1.6 + Plesk 12.5?

Danke,

Lasse

Hi Lasse,

anbei die notwendigen Anpassungen für nginx/PHP-FPM Modus mit Plesk mittels Custom-Config, welche wir bei uns einsetzen.

https://oc.aix-cloud.de/s/7jsqPfy6BMcnBOx

VG

1 „Gefällt mir“

Großen dank euch :slight_smile:

Hallo @AIXPRO‍,

habt ihr vielleicht noch einmal eine aktuelle Konfiguration für NGINX unter Plesk (17.5 bzw. 17.8) mit aktueller Shopware (5.3.7/5.4)?

DANKE :slight_smile:

 

 

Davon ab würde mich auch noch das Thema Microcaching unter nginx interessieren, macht es sinn hier etwas einzurichten?

Was ist mit mod_pagespeed, bringt es viel? Der Konfigurationsaufwand soll groß sein…?

Hi,

anbei die Config für “echtes” nginx Hosting auf Basis von Plesk 17.5 / 17.8 - http://oc.aix-cloud.de/s/L7JaUCAkfFuKobP

Für Microcaching und/oder mod_pagespeed direkt unter nginx musst Du nginx mit entsprechenden Parametern neu kompilieren. Wir haben so auch bereits Brotli (Brotli – Wikipedia) als GZIP Alternative im Einsatz. Schau Dir auch mal den LiteSpeed Webserver als Alternative zu Apache/nginx an - gibt es als Erweiterung in Plesk. Ebenso lohnt ein Blick bei CentOS 7 / Ubuntu 16 in Verbindung mit Plesk 17.5 / 17.8 auf Apache 2.4 im FPM Modus. Unsere Tests zeigen hier eine bessere Performance im Vergleich zum direkten nginx Setup - wobei LiteSpeed dann noch einen Tick schneller ist als beide Varianten - gerne weitere Infos per PM.

VG