Shopware 4 + Nginx + PHP-FPM = Redirect Error :(

Hallo Shopware Community! Ich bin langsam echt am verzweifeln, erst bekomme ich Shopware nicht auf einem Apache Server mit PHP-FPM FastCGI Erweiterung zum laufen und dann streikt mir der Nginx auch noch bei der Einrichtung. -.- Zuerst meine Ausgangslage: Mein Ziel ist es auf einem root Server mehrere Shopware Installationen zu hosten und verschiedenen Nutzern per Pure-FTP Server die Möglichkeit zu geben, selbst ihre Datenbestände hoch zu laden und CSS Datein zu modifizieren. Mit dem Apache und mod_php läuft Shopware vorbildlich stabil, leider kann ich jedoch keine vernünftige FTP Lösung integrieren, wegen des bekannten Rechteproblems mit mod_php. Die PHP_FPM Lösung scheitert mir ebenfalls an einem Fehler im Backend der Shopsysteme, welches wohl bekannt sei und weswegen der Einsatz von Shopware mit Apache Servern nicht empfohlen wird. Deswegen arbeite ich nun daran einen Nginx Server an meine Anforderungen azupassen und komme bei den Redirect Regeln einfach nicht weiter. Meine Konfiguration sieht folgendermaßen aus: /etc/nginx/nginx.conf [quote]user nginx; worker_processes 4; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; ## Detect when HTTPS is used map $scheme $fastcgi_https { default off; https on; } log_format main '$remote_addr - $remote_user [$time_local] „$request“ ’ '$status $body_bytes_sent „$http_referer“ ’ ‚"$http_user_agent" „$http_x_forwarded_for“‘; access_log /var/log/nginx/access.log main; sendfile on; keepalive_timeout 2; # Load config files from the /etc/nginx/conf.d directory # The default server is in conf.d/default.conf include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*.conf; } [/quote] /etc/nginx/conf.d/default.conf -> LEER /var/www/shopware.conf [quote]# Shopware nginx rules # version 1.0 # date 09.08.2011 # author Stefan Hamann

Defining various options

    # Set DirectoryIndex
    index shopware.php index.php;

    # Deny direct access to all smarty templates
    location ~ ^/templates/.*/*.tpl {
            deny all;
    }

    # Permit access to php files in web readable directories
    location ~ ^/cache/.*/*.(php|cgi|php5|php3|php4|phtml|pl|py) {
            deny all;
    }
    location ~ ^/images/.*/*.(php|cgi|php5|php3|php4|phtml|pl|py) {
            deny all;
    }
    location ~ ^/files/.*/*.(php|cgi|php5|php3|php4|phtml|pl|py) {
            deny all;
    }
    location ~ ^/upload/.*/*.(php|cgi|php5|php3|php4|phtml|pl|py) {
            deny all;
    }

Defining rewrite rules

    rewrite /images/ayww/(.*) /images/banner/$1 last;
    rewrite /files/documents/.* /engine last;
    rewrite /templates/(.*(css|js))$ /engine/backend/php/sCacheTemplate.php?file=/templates/$1 last;
    rewrite /sitemap.xml(.*) /shopware.php?controller=SitemapXml;
    rewrite /application.yaml /engine last;
    rewrite /engine/core/php/sAjaxSearch.php$ /engine/backend/php/sAjaxSearch.php last;
    rewrite /engine/core/php/campaigns.php$ /engine/backend/php/campaigns.php last;
    rewrite /install/step.* /install/index.php last;

Defining controller based route processing behaviour

    if (!-e $request_filename) {
            rewrite . /shopware.php last;
    }

[/quote]

/etc/nginx/sites-available/somesite.com.vhost -> Link at sites-enabled

[quote]server {
listen 80;

   ## SSL directives might go here
   ## see [url=http://www.howtoforge.com/how_to_set_up_ssl_vhosts_under_nginx_plus_sni_support_ubuntu_11.04_debian_squeeze]http://www.howtoforge.com/how_to_set_up ... an_squeeze[/url]
   ## if you want to enable SSL for this vhost

   server_name [url=http://www.somesite.com]http://www.somesite.com[/url] somesite.com;
   root /var/www/somesite.com/;
   if ($http_host != "www.somesite.com") {
             rewrite ^ [url=http://www.somesite.com$request_uri]http://www.somesite.com$request_uri[/url] permanent;
   }
   index index.php index.html;

   location = /favicon.ico {
            log_not_found off;
            access_log off;
   }
   location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
   }

   location ~ /\. {
            deny all;
   }

   location ~ /(engine|files|templates|media/[a-z]+)/ {
   }

   location / {
            index index.html index.php shopware.php
            rewrite shopware.dll /shopware.php;
            rewrite files/documents/.* /engine last;
            rewrite images/ayww/(.*) /images/banner/$1 last;
            rewrite backend/media/(.*) media/$1 last;
            if (!-e $request_filename){
                rewrite . /shopware.php last;
            }
   }

   location ~ \.(tpl|yml|ini)$ {
            deny all;
   }

   location /install {
            location /install/assets {
            }
            if (!-e $request_filename){
                rewrite . /install/index.php last;
            }
   }

   location ~ \.php$ {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param HTTPS $fastcgi_https;
   }

}
[/quote]

Über jede Idee, Anregung oder Klarstellung wär ich euch zu Dank verpflichtet, denn ich komme grad echt nicht weiter.

Das hauptproblem bei dieser Konfiguration ist jetzt, dass ich bei Zugriff auf die Shopware Stammseite wie auch den install Ordner, vom Browser immer einen Redirect Error ausgegeben bekomme. Die Beispielkonfiguration von der Shopware Seite (http://wiki.shopware.de/Shopware-mit-Ng … l_696.html) gestattet mir hingegen zwar den Zugriff auf die Shopware Startseite und die erste Seite der Installation, springt aber immer wieder auf die Startseite zurück, wenn ich in der Installation etwas auswähle.

installation-einstieg-f54/manuelle-installation-bzw-installation-mit-nginx-t8277.html?hilit=nginx

Hallo Zusammen, unter https://gist.github.com/4024794 habe ich euch meine Shopware Nginx Konfiguration bereitgestellt. Ich bin leider noch nicht dazu gekommen das ganze als WIKI Eintrag aufzubereiten. Viele Grüße Benjamin Cremer :shopware:

Ich Grüsse euch! Erstmal Danke für die Antworten. :slight_smile: An Benjamin Cremer: Interessante Konfiguration. Ich hab mal versucht in ner VM diese nachzubilden und dabei das Problem mit den nginx Repositories entdeckt… nginx also entfernt, das nginx repo hinzugefügt und in der Version 1.2.4-1.el6.ngx neu installiert. Nun häng ich bei folgendem Fehler x] [quote]nginx: [emerg] “upstream” directive is not allowed here in /etc/nginx/nginx.conf:34[/quote] Ich recherchier mal weiter und geb wieder bescheid…

upstream direktive sitzt nun hinter der html direktive. Nachricht beim starten: [quote]nginx: [emerg] no port in upstream “php-fpm” in /etc/nginx/global/shopware.conf:113[/quote]

Hallo, die upstream definition muss innerhalb der http-Direktive stehen. Ich habe den Gist nochmal aktualisiert und die Komplette nginx.conf angehangen. Viele Grüße, Benjamin Cremer :shopware:

So, ich hab jetzt zwar nen anderen Weg gewählt und die upstream direktive in eine eigene conf Datei ausgelagert, aber dank deiner Beispiel-Konfiguration hab ich es jetzt zum laufen bekommen. :slight_smile: DANKE!!! :smiley: PS: Nu muss ich nur noch phpmyadmin lauffähig bekommen, über das Werkezug kann ich mich nämlich einfach nicht an dem MySQL Server anmelden, aber das ist ein anderes Thema. ^^ Danke nochmals :wink: