Giter VIP home page Giter VIP logo

shopware-with-nginx's Introduction

Nginx configuration for running Shopware

This is an example configuration for running Shopware using nginx. Which is a high-performance non-blocking HTTP server.

This configuration is heavily inspired by perusio's drupal-configuration.

Warning

Please only use nginx if you know what you are doing. Shopware AG provides no support for running nginx as appserver. Also note that Shopware will not run faster with nginx. A properly configured apache webserver is in most cases as fast as nginx.

Compatibility

This configuration is tested with Shopware 5.1 or later.

Installation

  1. Move the old /etc/nginx directory to /etc/nginx.old.

  2. Clone the git repository from github:

    git clone https://github.com/bcremer/shopware-with-nginx.git /etc/nginx
    
  3. Setup the PHP-FPM upstream in conf.d/upstream.conf

  4. Edit or copy the sites-available/example.com.conf configuration file to suit your requirements.

  5. Enable your site configuration

    ln -s ../sites-available/example.com.conf /etc/nginx/sites-enabled/
    
  6. Reload nginx

shopware-with-nginx's People

Contributors

bcremer avatar damdaki avatar dnoegel avatar emilv avatar gbotti avatar janbuecker avatar lhwparis avatar plugware avatar pmuckel avatar roman-1983 avatar shyim avatar soebbing avatar wbob avatar xf- avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shopware-with-nginx's Issues

SEO url rewrite issue with .html ending

Wenn Ich in SEO/Router Einstellungen für Artikel folgende Template benutze - {sCategoryPath articleID=$sArticle.id}/{$sArticle.name}.html, nginx zeigt immer 404 Fehler. Das selbe mit Categorie-Template. Ohne .html funktioniert seo-rewrite ohne Probleme.

504 Gateway-Timeout on Backend

At some point we experienced nginx timeouts, for example during product imports oder exports.
I've added fastcgi_read_timeout 300 into the global nginx config, which is enough for now.

As PHP itself handles the timeouts while the import/export scripts, what would be the best way for nginx to "listen" to the php timeouts instead of cutting it off?

Updates are not possible ...

Hi all,

with this config, i'm not able to update Shopware.

I tried to reproduce this problem with a clean and fresh install (v 5.1.6) and want to update to 5.2.6 (also tried a while ago to update to 5.2.1).

The update stops at http://domain.com/recovery/update/index.php/dbmigration
Showing:

Error
Received an error message.
URL: unpack?offset=0&total=0
Message: Not Found

Please try to fix this error and restart the update.
Response
404 Page Not Found
The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.

I think its because the nginx config does not take the following URLs into account:
http://domain.com/recovery/update/index.php/unpack?offset=0&total=0

I tried to change the jquery update script to get URLs like this (removed the "index.php"):
http://domain.com/recovery/update/unpack?offset=0&total=0

But this also does not work. I think its because the PHP Update Script uses app.map("/unpack").

I also tried several nginx changes but none of them works. Any help is greatly appreciate!

Greets,

Chris

Conf is blocking Let's encrypt challenge

I am using auto-renewal certificates from Let's encrypt for my shopware installations. The problem with this config is that it somehow blocks the access to the let's encrypt files. Any idea how to bypass this issue?

Thanks in advance

Plugin Rewrite Fehler

Es gibt aktuell ein Problem mit Plugins wie z.B. Actindo WaWi.
http://wiki.actindo.de/index.php?title=Shopware_4

Normal spricht man das Plugin mit www.domain.tdl/Actindo/ an.
Das Plugin kann man manuell unter www.domain.tdl/Actindo/xmlrpc_server.php?get_cryptmode=1&username=test bzw. www.domain.tdl/shopware.php/Actindo/xmlrpc_server.php?get_cryptmode=1&username=test aufrufen und hier kommt dann eine Antwort.

Bei Apache funktioniert dies problemlos, bei NGINX mit der .conf leider aktuell nicht.
Es kommt eine 404 ERROR.

Ich habe schon viel rumprobiert, leider komme ich nicht drauf woran es hier hängt.

// UPDATE:
Ich habe nun das Problem gefunden.
Da hier eine PHP Datei direkt aufgerufen werden muss, funktioniert location ~ .php$ { natürlich nicht,
weil er nun direkt die PHP Datei xmlrpc..... aufrufen will und deshalb der 404 kommt.
Wenn ich location ~ shopware.php$ { schreibe funktioniert es nun korrekt.
Die Frage ist ob diese Korrektur nicht negative Auswirkungen auf die Basis Shopware Funktionen hat.

ESD Download - 404

Wenn ich in den Artikeleinstellungen unter ESD die gewünschte Datei auswähle und dann oben auf Datei herunterladen klicke werde ich auf folgende URL weitergeleitet und bekomme einen 404 not found:

https://SHOPURL/backend/Article/getEsdDownload/filename/testfile.png

Normalerweise sollte in der shopware.conf ja ein rewrite dafür geben aber bei mir geht es aus dem Admin Interface heraus nicht.
Wie muss ich meine config ergänzen damit dies funktioniert?

shopware.conf ---> robots.txt

this entry works not with robots.txt --> error 404 with nginx.

robots.txt support.

location = /robots.txt {
log_not_found off;
access_log off;
}

change it with...

location = /robots.txt {
log_not_found off;
access_log off;
try_files $uri @shopware;
}

it works. ;-)

Let's Encrypt conflict

We usually add the following location block for Let's Encrypt verification:

    location '/.well-known/acme-challenge' {
        default_type "text/plain";
        root /var/www/letsencrypt;
    }

Trying to add a new certificate we get a 403 error from

Removing that line still results in a 404 error.

Hardened Configuration for Shopware

I had the idea of a Hardened Configuration what covers things like

  • Remove access to all folders except folders: themes, media, web
  • Add ip based whitelist to /backend and optional /api, otherwise rewrite to error controller
  • Remove all return 404 and rewrite to error controller, to have the same look and feel on blocked resources

What do you think about that? :)

robot.txt location in shopware.conf

Ich glaube sollte robot.txt location in shopware.conf auskommentiert sein, weil es ab Shopware 4 robot.txt über template erstellt wird. Oder entsprechende Hinweis dazu einfügen?

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

Is it still recommendable to use SW on Nginx?

Hi @bcremer,

nice to find an unofficial repository of configurations for nginx from an official Shopware Tech member.

My question is, even so, do you (or is it) still recommended to use Shopware on Nginx, regardless of the official support? Is it reliable? What are the most common examples of something that can go wrong?

Thanks.

Add expires max for generated css/js files

location ~* "^/web/cache/([0-9]{10})_(.+)\.(js|css)$" {
    expires max;
    add_header Vary Accept-Encoding;
    add_header Pragma public;
    add_header Cache-Control "public";
    access_log off;
}

Configurable php-fpm upstream

global/shopware.conf is brilliant. Worked much better than my first attempt at a Shopware snippet!

We would prefer to have different PHP-FPM upstreams for different servers. I implemented this on our server by changing fastcgi_pass to:

fastcgi_pass $fpm_upstream;

and in the server { ... } block setting the variable along with the environment key:

set $fpm_upstream php-staging;
set $shopware_env 'staging';

Shopware Staging Plugin

Ahoi,

wo würde man hier am geschicktesten die Übergabe im Stil eines

fastcgi_params ENV staging;

einbauen, um das Staging Plugin nutzen zu können - bzw. ist das über obiges Kommando problemlos möglich? Da Apache nur

SetEnvIf Host "staging.ihrshop.com" ENV=staging

benötigt, hätte ich vermutet ein zweiter VHost à la example.com.conf mit einer fastcgi_params Zeile VOR dem Include der global/shopware.conf würde das ggf. lösen.

Ist das machbar bzw. könnte man das als Beispiel inkludieren?

Dank und Gruß
Jens

Subshops not working

Hey,
thank u very much for your work. It works good but the routing for the subshops is not working.

For example:
https://{domain}.com/{subpage} is working!
https://{domain}.com/{subshop}/{subpage} is not working (e. g. https://{domain}.com/en/imprint).

Do you have any ideas why this is not working?

Thank u!

Feature-Request: Subfolder installation config

If shopware is installed in a subfolder (as suggested by the shopware support for testing/help) a config for this scenario would be great. I think there are some pitfalls and a bit more work than just prepending the subfolder path is required.

Get rid of hardcoded ESD key in global/shopware.con

After merging PR #8 I was thinking about creating a variable for the esd key to get rid of the hardcoded value in global/shopware.con.

# sites-available/example.com.conf
set $shopware_esd_key '552211cce724117c3178e3d22bec532ec';`
# global/shopware.con
location ^~ /files/$shopware_esd_key/ {
    internal;
}

Unfortunately that seems not possible with plain Nginx config.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.