Snippets

Nikolay Galkin z9jyx: Untitled snippet

Created by Nikolay Galkin last modified
FROM php:5.6-fpm

RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
    && docker-php-ext-install zip mcrypt pdo_mysql
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install gd

CMD ["php-fpm"]
db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: 123
    MYSQL_USER: user
    MYSQL_PASSWORD: password
    MYSQL_DATABASE: database
  volumes:
    - .docker/db/data:/var/lib/mysql

backend:
  build: .
  volumes:
    - ./upload:/var/www/html
  links:
    - db

web:
  image: nginx
  ports:
    - "80:80"
  volumes:
    - .docker/nginx/sites:/etc/nginx/conf.d
    - .docker/nginx/logs:/var/log/nginx
    - ./upload:/var/www/html
  links:
    - backend
server {
    listen 80;
    server_name www.host.com;

    add_header Strict-Transport-Security max-age=2592000;
    return 301 http://host.com$request_uri;
}


server {
    listen 80;
    server_name host.com;

    root /var/www/html;
    index index.php index.html index.htm;
    charset utf-8;

    access_log  /var/log/nginx/host.com.access.log;
    error_log   /var/log/nginx/host.com.error.log;

    rewrite /admin$ $scheme://$host$uri/ permanent;

    location / {
        try_files $uri @opencart;
    }

    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

    location /admin {
        index index.php;
    }

    rewrite ^/sitemap.xml$ /index.php?route=feed/google_sitemap last;
    rewrite ^/googlebase.xml$ /index.php?route=feed/google_base last;
    rewrite ^/download/(.*) /index.php?route=error/not_found last;

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

    sendfile off;

    location ~\.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        fastcgi_pass backend:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.