openbridge / nginx

NGINX Accelerated! This is a Docker image that creates a high performance (FAST!), optimized image for NGINX for use with Redis and PHP-FMP. Deliver sites and applications with performance, reliability, security, and scale. This NGINX server offers advanced performance, web and mobile acceleration, security controls, application monitoring, and management.
https://www.openbridge.com/
MIT License
233 stars 53 forks source link

Help with a version to use with Prestashop 1.7+ #64

Closed msaustral closed 4 years ago

msaustral commented 4 years ago

Hi i have more or less a week trying to get Docker to work with Nginx Php-fpm an mariadb locally to use it with Prestashop 1.7 when i found your repo, it just took me half night to run it. the problem is that to make it work, i had to chance many conf files and i think that i disable redis i have no idea how to check it or if i mess up something, so can you help me checking?.

Prestashop 1.7 only runs with PHP 7.2 max, so i took you Docker php-fpm file and did this to build a new image:

`FROM php:7.2-fpm-alpine3.9

ENV VAR_PREFIX=/var/run ENV LOG_PREFIX=/var/log/php-fpm ENV TEMP_PREFIX=/tmp ENV CACHE_PREFIX=/var/cache

RUN set -x \ && apk add --no-cache --virtual .build-deps \ wget \ linux-headers \ curl \ unzip \ && echo '@community http://dl-cdn.alpinelinux.org/alpine/v3.9/community' >> /etc/apk/repositories \ && apk add --no-cache --update \ php7-dev@community \ php7-bcmath@community \ php7-dom@community \ php7-common@community \ php7-ctype@community \ php7-cli@community \ php7-curl@community \ php7-fileinfo@community \ php7-fpm@community \ php7-gettext@community \ php7-gd@community \ php7-iconv@community \ php7-json@community \ php7-mbstring@community \ php7-mcrypt@community \ php7-mysqli@community \ php7-mysqlnd@community \ php7-opcache@community \ php7-odbc@community \ php7-pdo@community \ php7-pdo_mysql@community \ php7-pdo_pgsql@community \ php7-pdo_sqlite@community \ php7-phar@community \ php7-posix@community \ php7-redis@community \ php7-session@community \ php7-simplexml@community \ php7-soap@community \ php7-tokenizer@community \ php7-xml@community \ php7-xmlreader@community \ php7-xmlwriter@community \ php7-simplexml@community \ php7-zip@community \ php7-zlib@community \ php7-intl \ mysql-client\ curl \ monit \ bash \ xz \ openssl \ icu-libs \ ca-certificates \ libxml2-dev \ tar \ && mkdir -p /var/run \ && mkdir -p ${LOG_PREFIX} \ && rm -rf /tmp/ \ && rm -rf /var/cache/apk/ \ && touch ${LOG_PREFIX}/access.log \ && touch ${LOG_PREFIX}/error.log \ && ln -sf /dev/stdout ${LOG_PREFIX}/access.log \ && ln -sf /dev/stderr ${LOG_PREFIX}/error.log

COPY conf/monit/ /etc/monit.d/ COPY docker-entrypoint.sh /docker-entrypoint.sh COPY check_wwwdata.sh /usr/bin/check_wwwdata COPY check_folder.sh /usr/bin/check_folder

EXPOSE 9000

RUN chmod +x /docker-entrypoint.sh /usr/bin/check_wwwdata /usr/bin/check_folder

ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["php-fpm7", "-g", "/var/run/php-fpm.pid"]`

then i had to change the nginx secure.conf nginx.conf location.conf as the folders are different to WP, here is the PS official Nginx config https://github.com/PrestaShop/PrestaShop/blob/develop/docs/server_config/nginx.conf.dist

I think i mess up on the default.vhost as i had to change the location / to this

location / { error_page 502 =200 @failed; try_files $uri $uri/ /index.php?$args; if (!-e $request_filename) { rewrite ^/.*$ /index.php last; } } include /etc/nginx/conf.d/location.conf; include /etc/nginx/redis.d/location.conf; taking out the proxy (if i live it, the admin panel does not work)

also i did change the location .php in location.conf as when i was getting into the web page it was downloading the php file instead of ruing it.

`location ~ [^/].php(/|$) { try_files $fastcgi_script_name /index.php$uri&$args @php-fpm; fastcgi_index index.php; include fastcgi_params; fastcgi_pass php-fpm; include /etc/nginx/fastcgi.d/fastcgi.conf; include /etc/nginx/redis.d/cache.conf; } location ~ .(jpg|jpeg|png|gif|ico|css|js|woff(?:2)?)$ { expires 365d; } location ~ .(css|js)$ { expires 7d; }

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

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

    # Images
    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 ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;
    try_files $uri $uri/ /index.php?$args;

    # AlphaImageLoader for IE and fancybox
    rewrite ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 last;

    # Web service API
    rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;

` so at the end i am not sure of what i have done, if you can help me it will be fantastic!, thank you

tspicer commented 4 years ago

Hi @msaustral , a bit late to reply. Hope you figured this out. It would take a fair amount of time to troubleshoot your work. This falls outside of this project given we do this for free and you (I assume) are getting paid for your work ; )

If you wanted to contact an engineer to dig into this, we do have hourly rates.

msaustral commented 4 years ago

Hi thank you for your reply, we have no problem to pay for if the price is right, have a good day.