V
V
Vadim kyklaed2019-04-04 15:01:15
Nginx
Vadim kyklaed, 2019-04-04 15:01:15

How to set up nginx for opencart?

Hello, how to set up jinx to work with opencart? I need locally on a virtual machine, how to set up jinx and opencart to just work on a local IP?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
uaVPS, 2019-04-04
@kyklaed

I recommend the nginx + php-fpm bundle nginx
config

server {
  listen 10.0.1.6:443 ssl;
  server_name site.org www.site.org;
  ssl_certificate "/etc/nginx/ssl/site.org.cer";
  ssl_certificate_key "/etc/nginx/ssl/site.org.key";
  charset utf-8;
  index index.php index.html;
  disable_symlinks if_not_owner from=$root_path;
  access_log /var/www/site.org/log/site.org.access.log;
  error_log /var/www/site.org/log/site.org.error.log notice;
  set $root_path /var/www/site.org/www;
  root $root_path;

  if ($host ~* www\.(.*)) {
      set $host_without_www $1;
      rewrite ^(.*)$ http://$host_without_www$1 permanent;#301 redirect
   }

  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
  }

  if (!-e $request_filename){
      rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }
  }

  location @fallback {
    error_log /dev/null crit;
    access_log off ;
  }

    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      expires 180d;
      log_not_found off;
      add_header Pragma public;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate";
      try_files $uri $uri/ @fallback;
    }

  # Fix for Firefox issue with cross site font icons
  location ~* \.(eot|otf|ttf|woff)$ {
    add_header Access-Control-Allow-Origin *;
  }

  location ~* (\.(tpl|ini))$ { deny all; }

  location ~* \.(engine|inc|info|ini|install|log|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
    deny all;
  }

  location ~ /\. {
    access_log off;
    log_not_found off;
    deny all;
  }

  location ~ ~$ {
    access_log off;
    log_not_found off;
    deny all;
  }

  location ~* /(?:cache|logs|image|download)/.*\.php$ {
    deny all;
  }

  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass unix:/run/php/site.org.sock;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_intercept_errors on;
    fastcgi_ignore_client_abort off;
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
  }

        location ~ /\.ht    {return 404;}
        location ~ /\.tpl/  {return 404;}
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question