Pimcore does not work with Nginx

Discussion in 'ISPConfig 3 Priority Support' started by misterm, Jun 23, 2018.

  1. misterm

    misterm Member HowtoForge Supporter

    Hello
    Cannot run this CMS under ISPconfig 3 under Debian 9
    https://www.howtoforge.com/tutorial/ubuntu-nginx-pimcore-cms/
    The config that I use
    and also when I apply this setup I have this that displays me in my browser:
    Thank you for your help
    Mz
     
  2. misterm

    misterm Member HowtoForge Supporter

    When I apply this config, my browser does not find PHP

    https://pimcore.com/docs/5.x/Develo...em_Setup_and_Hosting/Nginx_Configuration.html

    PHP info
    Mz
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The above config is a complete vhost and not just a rewrite part. Instead of using the above config which is not compatible with your setup, use just the rewrite part:

    Code:
    client_max_body_size 100M;
    
    location / {
    try_files $uri /app.php$is_args$args;
    }
    and add this in the nginx directives field of the website
     
  4. misterm

    misterm Member HowtoForge Supporter

    Hello Till
    I use this setup with modification...
    Under Chrome I have this as an error...
    Mz
     
    Last edited: Jun 25, 2018
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    So you don't use an ISPConfig website for pimcore? Or why don't you try to use the config I suggested instead of your non working config..
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    And in regards to the more extended setup from pimcore website, you can try this in the nginx directives field of the website:

    Code:
        # Pimcore Head-Link Cache-Busting
        rewrite ^/cache-buster-(?:\d+)/(.*) /$1 last;
    
        # Stay secure
        #
        # a) don't allow PHP in folders allowing file uploads
        location ~* /var/assets/*\.php(/|$) {
            return 404;
        }
        # b) Prevent clients from accessing hidden files (starting with a dot)
        # Access to `/.well-known/` is allowed.
        # https://www.mnot.net/blog/2010/04/07/well-known
        # https://tools.ietf.org/html/rfc5785
        location ~* /\.(?!well-known/) {
            deny all;
            log_not_found off;
            access_log off;
        }
        # c) Prevent clients from accessing to backup/config/source files
        location ~* (?:\.(?:bak|conf(ig)?|dist|fla|in[ci]|log|psd|sh|sql|sw[op])|~)$ {
            deny all;
        }
    
        # Some Admin Modules need this:
        # Database Admin, Server Info
        location ~* ^/admin/(adminer|external) {
            rewrite .* /app.php$is_args$args last;
        }
        
        # Thumbnails
        location ~* .*/(image|video)-thumb__\d+__.* {
            try_files /var/tmp/$1-thumbnails$uri /app.php;
            expires 2w;
            access_log off;
            add_header Cache-Control "public";
        }
    
        # Assets
        # Still use a whitelist approach to prevent each and every missing asset to go through the PHP Engine.
        location ~* (.+?)\.((?:css|js)(?:\.map)?|jpe?g|gif|png|svgz?|eps|exe|gz|zip|mp\d|ogg|ogv|webm|pdf|docx?|xlsx?|pptx?)$ {
            try_files /var/assets$uri $uri =404;
            expires 2w;
            access_log off;
            log_not_found off;
            add_header Cache-Control "public";
        }
    
        # Installer
        # Remove this if you don't need the web installer (anymore)
        if (-f $document_root/install.php) {
            rewrite ^/install(/?.*) /install.php last;
        }
    
        location / {
            error_page 404 /meta/404;
            add_header "X-UA-Compatible" "IE=edge";
            try_files $uri /app.php$is_args$args;
        }
     

Share This Page