Claudiocool Posted July 22, 2017 Share Posted July 22, 2017 (edited) Hallo Freunde, ich habe bei der Umstellung auf PHP 7.0.x auf Apache umgestellt anstatt die Sache unter NGINX laufen zu lassen.Das möchte ich jetzt wieder auf nginx zurückführen, habe aber blöderweise mein Config-File nicht mehr im Backup. Um den Shop laufen zu lassen, müssen im Prinzip ja die Rewrites rein, wie in der htaccess? Die Deny's kommen auch da rein? Ich habe mal kurz Settings vom GitHub getestet, die liessen zumindest das Frontend laufen, aber das Backoffice weigerte sich dann beharrlich, zu funktionieren. Können die Rewrite-Rules etc. unten ans Konfigfile angehängt werden? Das Konfigfile auf dem Server sieht im Moment so aus (ist ein Default-File): #user nginx; worker_processes 1; #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; include /etc/nginx/modules.conf.d/*.conf; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #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; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #tcp_nodelay on; gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_proxied any; gzip_buffers 16 8k; gzip_types text/plain text/html text/css text/xml application/x-javascript application/xml application/xml+rss text/javascript; gzip_vary on; server_tokens off; include /etc/nginx/conf.d/*.conf; } # override global parameters e.g. worker_rlimit_nofile include /etc/nginx/*global_params; Edited July 22, 2017 by Claudiocool (see edit history) Link to comment Share on other sites More sharing options...
Claudiocool Posted July 22, 2017 Author Share Posted July 22, 2017 (edited) .... mist, wollte oben noch die .htaccess paosten, aber irgendwie hat das nicht geklappt.... Kennt sich da jemand aus und kann mir sagen, ob das vom Format her klappt, wenn ich das jetzt noch an das obige Config dranhänge oder ob ich da was vergessen habe, das mich dann irgendwann einholt.... Mist, ich kann da den Code nicht speichern, warum das denn..... Ok, wenn ich den htaccess-.code in ein Format für die NGINX-Datei ändere, kann ich das dann einfach an die Konfigartion dranhängen? Edited July 22, 2017 by Claudiocool (see edit history) Link to comment Share on other sites More sharing options...
TimmeHosting Posted July 22, 2017 Share Posted July 22, 2017 Du benötigst noch einen server{}-Container (das ist Dein Vhost), und in diesem Container benötigst Du folgende Direktiven für PrestaShop 1.7: location ~ "^/admin(.*?)/" { client_max_body_size 100M; if (!-e $request_filename) { rewrite ^/admin(.*?)/.*$ /admin$1/index.php last; } } location ~ "^/backoffice(.*?)/" { client_max_body_size 100M; if (!-e $request_filename) { rewrite ^/backoffice(.*?)/.*$ /backoffice$1/index.php last; } } location / { client_max_body_size 100M; rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; try_files $uri $uri/ /index.php$is_args$args; error_page 404 /index.php?controller=404; #location ~ "^/admin(.*?)/" { # if (!-e $request_filename) { # rewrite ^/admin(.*?)/.*$ /admin$1/index.php last; # } #} location ~* \.(gif)$ { rewrite ^/images_ie/?([^/]+)\.(gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(jpeg|jpg)$ { rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last; rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last; rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; rewrite ^/images_ie/?([^/]+)\.(jpe?g)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(png)$ { rewrite ^/images_ie/?([^/]+)\.(png)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(css)$ { expires 604800s; } location ~* \.(js|jsonp)$ { expires 604800s; } location ~* \.(js)$ { expires 604800s; } location ~* \.(ico)$ { expires 31536000s; } location ~* \.(ttf|ttc|otf|eot|woff|svg)$ { add_header Access-Control-Allow-Origin *; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; {FASTCGIPASS} fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param PATH_INFO $fastcgi_script_name; #fastcgi_intercept_errors on; fastcgi_temp_file_write_size 10m; fastcgi_busy_buffers_size 512k; fastcgi_buffer_size 512k; fastcgi_buffers 16 512k; fastcgi_read_timeout 1200; } } {FASTCGIPASS} mußt Du entsprechend ersetzen (s. http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_pass ). 1 Link to comment Share on other sites More sharing options...
Claudiocool Posted July 22, 2017 Author Share Posted July 22, 2017 ich hab 1.6.1.x kein1.7 Der Servercontainer ist der hier? server { listen 80 default_server; listen [::]:80 default_server; ### HTTP2 Part listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name localhost; client_max_body_size 10M; root /html; index index.php index.html; error_log /var/log/nginx/error.log; access_log /var/log/nginx/access.log; ## Adding Caching # cache.appcache, your document html and data location ~* \.(?:manifest|appcache|xml|json)$ { expires -1; } Link to comment Share on other sites More sharing options...
TimmeHosting Posted July 22, 2017 Share Posted July 22, 2017 (edited) Richtig, das ist der Servercontainer. Für PrestaShop 1.6 nimm' bitte mal folgende Konfiguration: location / { client_max_body_size 100M; rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; try_files $uri $uri/ /index.php$is_args$args; error_page 404 /index.php?controller=404; location ~* \.(gif)$ { rewrite ^/images_ie/?([^/]+)\.(gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(jpeg|jpg)$ { rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg last; rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last; rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last; rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last; rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg last; rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last; rewrite ^/images_ie/?([^/]+)\.(jpe?g)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(png)$ { rewrite ^/images_ie/?([^/]+)\.(png)$ /js/jquery/plugins/fancybox/images/$1.$2 last; expires 2592000s; } location ~* \.(css)$ { expires 604800s; } location ~* \.(js|jsonp)$ { expires 604800s; } location ~* \.(js)$ { expires 604800s; } location ~* \.(ico)$ { expires 31536000s; } location ~* \.(ttf|ttc|otf|eot|woff|svg)$ { add_header Access-Control-Allow-Origin *; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; {FASTCGIPASS} fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_param PATH_INFO $fastcgi_script_name; #fastcgi_intercept_errors on; fastcgi_temp_file_write_size 10m; fastcgi_busy_buffers_size 512k; fastcgi_buffer_size 512k; fastcgi_buffers 16 512k; fastcgi_read_timeout 1200; } } Edited July 22, 2017 by TimmeHosting (see edit history) Link to comment Share on other sites More sharing options...
Claudiocool Posted July 22, 2017 Author Share Posted July 22, 2017 (edited) Wenn ich den Servercontainer eingebe, kriege ich eine Fehlermeldung nginx: [emerg] "server" directive is not allowed here in /etc/nginx/nginx.conf:50 Andererseits läuft ja z.B. Piwik auch auf dem Server ohne Probleme, nur der Presta scheint da in der Konfig eben diese Einträge zu wollen. Weiter bin ich vorhin mal soweit gekommen, dass der Shop im Frontend lief, im BO aber nicht geladen wurde.... Edited July 22, 2017 by Claudiocool (see edit history) Link to comment Share on other sites More sharing options...
Claudiocool Posted July 22, 2017 Author Share Posted July 22, 2017 Mit der Konfiguration kriege ich dann weitere Fehlermeldungen.... Unable to generate the web server configuration file on the host <xxxx.cdfgroup.de> because of the following errors: Template_Exception: nginx: [warn] duplicate MIME type "text/html" in /etc/nginx/nginx.conf:39 nginx: [emerg] "location" directive is not allowed here in /etc/nginx/nginx.conf:50 nginx: configuration file /etc/nginx/nginx.conf test failed file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 75 code: 0 Please resolve the errors in web server configuration templates and generate the file again. Link to comment Share on other sites More sharing options...
TimmeHosting Posted July 23, 2017 Share Posted July 23, 2017 Kannst Du Deine komplette Konfiguration posten? Vermutlich hast Du Direktiven im falschen Kontext angelegt. Link to comment Share on other sites More sharing options...
Claudiocool Posted July 23, 2017 Author Share Posted July 23, 2017 (edited) Was wäre das alles? ganz oben im Thread hier ist der momentane Inhalt der nginx.conf Ich habe da jetzt im nginx-Verzeichnis noch einen pfad "plesk.conf.d" und darin einen Pfad "vhosts" mit unseren ganzen Domains entdeckt, der wohl die Serverdirektiven zu enthalten scheint. Kann es sein, dass hier der Ansatz ist und ich die rewriterules dort reinsetzen muss? Edited July 23, 2017 by Claudiocool (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted July 23, 2017 Share Posted July 23, 2017 Wenn du Plesk verwendest, dann werden die Direktiven in der Plesk.conf geschrieben und teils im ngnix. Verwendest du nginx proxied, also over apache ? Wenn ja, dann ersparst du dir rewrites zu übersetzen für den nginx. Weil hier de mod-rewrite vom Apache greift und nicht vom ngnix. Hast du einen reinen ngnix, musst du die rewrites alle übersetzen. 1 Link to comment Share on other sites More sharing options...
Claudiocool Posted July 23, 2017 Author Share Posted July 23, 2017 Da die Zugriffe laut logs jetzt schon teilweise über nginx gehen, vermute ich genau das. Die Frage wäre halt, wo man dann einstellen kann, wie das genau gehandhabt werden soll. Link to comment Share on other sites More sharing options...
selectshop.at Posted July 23, 2017 Share Posted July 23, 2017 Da die Zugriffe laut logs jetzt schon teilweise über nginx gehen, vermute ich genau das. Das sagt garnichts aus. Auch proxied ngnix ist ein ngnix. Du kannst alles via Plesk einstellen, da sind keinerlei manuelle Änderungen am vhost nötig. Plesk-Forum findest du hier: http://forum.odin.com/forums/plesk-for-linux.208/ Link to comment Share on other sites More sharing options...
Claudiocool Posted July 23, 2017 Author Share Posted July 23, 2017 (edited) Das heisst, im Prinzip wird bei einem proxied nginx automatisch festgelegt, was da gehandled wird? Hier habe ich mal ein Bild der entsprechenden einstellungen.... Edited July 23, 2017 by Claudiocool (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted July 23, 2017 Share Posted July 23, 2017 Nein, das kannst du im Plesk einstellen. Ich gehe mal davon aus, dass du im Plesk unter den Komponenten "nginx proxy support, ngnix webserver und php-fpm support" aktiviert hast. Wenn ja, dann findest du die Einstellungen im Plesk unter: Webseiten & Domains -> deine Domain -> Webserver-Einstellungen -> Unter ngnix-Einstellungen KEIN HAKEN bei "PHP von Nginx verarbeiten lassen". Somit laufen alle Skripte im Apache Modus. Intelligente Bearbeitung statischer Dateien mus ANGEHAKT sein. Finetuning kann man hier auch noch unter den Hosting-Einstellungen der Domain machen, indem du Perl, Fast-cgi usw. aktivierst und konfigurierst. Solche Fragen aber bitte im Plesk-Forum stellen. Prestashop ist nicht der richtige Ort dafür, da es sich hier um eine persönliche Server-Konfigurastion handelt und nicht wirklich mit Prestshop zu tun hat. Sobald du Plesk verwendest, schreibt Plesk eigene conf-Dateien und regelt den Ablauf selbst über Plesk, Apache und in deinem Fall ngnix. Prio 1 sind die conf-Dateien von Plesk in diesem Fall, dann je nachdem was du aktiviert hast Apache oder ngnix (bzw. php-fpm) in der Reihenfolge. Link to comment Share on other sites More sharing options...
Claudiocool Posted July 23, 2017 Author Share Posted July 23, 2017 Gut, dann gehe ich mal davon aus, dass das soweit passt, Der Server an sich läuft problemlos, die einzige Sache war noch das mit dem PHP. Ein weiteres Forum tu ich mir an der stelle nicht an, es gibt auch noch ein Leben diesseits des Monitors Link to comment Share on other sites More sharing options...
selectshop.at Posted July 24, 2017 Share Posted July 24, 2017 Ein weiteres Forum tu ich mir an der stelle nicht an, es gibt auch noch ein Leben diesseits des Monitors Solltest du aber, wenn du Dinge in Angriff nimmst, die kein Teil des Prestashop Supports sind. Oder du beauftragst jemand der für dich deinen Server administriert, wenn das Know-How nicht vorhanden ist. Der Server ist Grundlage für alles andere und sollte passen. Willkürlich Einstellungen vornehmen, bzw. irgendwelche Skripte aus dem Netz zu nehmen, ohne dass man weiß was man tut, ist das Ergebnis dann dafür, dass etwas nicht reibungslos funktioniert. Link to comment Share on other sites More sharing options...
Claudiocool Posted July 24, 2017 Author Share Posted July 24, 2017 Solche Harakiri-Aktionen beschränke ich im Normalfall auf lokale Server zum Rumprobieren. Es ging hier in der Tat nur darum, zu testen, ob ein reiner Nginx mehr Performance hat als ein geproxter (cooles Wort ) Da die Servergeschichte ohnehin schon genug Zeit frisst, werde ich vermutlich irgendwann im Herbst (wenn dann noch weniger Zeit dafür verfügbar ist) auf eine Lösung unsatteln, bei der ich mit der Serveradministration wenig zu tun habe, aber der Betreiber ein offenes Ohr für meine Wünsche hat. Was alles nötig ist, weiß ich ja, das ist besser als nach und nach zu sehen, was fehlt und dann nichts zu bekommen Mal sehen, nach dem Urlaub werde ich mal schauen, ob es vernünftige Hoster mit guter Performance gibt. Link to comment Share on other sites More sharing options...
TimmeHosting Posted July 24, 2017 Share Posted July 24, 2017 Du kannst bei uns 14 Tage kostenlos testen, wenn Du möchtest. Dann könntest Du z.B. Deinen Shop einmal zu uns kopieren, um zu sehen, wie sich das von der Performance her auswirkt. Link to comment Share on other sites More sharing options...
Claudiocool Posted July 24, 2017 Author Share Posted July 24, 2017 Ich komme evtl. nach dem Urlaub drauf zurück Link to comment Share on other sites More sharing options...
TimmeHosting Posted July 24, 2017 Share Posted July 24, 2017 Wir würden uns freuen, und bis dahin einen schönen Urlaub! :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now