Post by 00001 » Sat Sep 07, 2019 3:34 am

Hi All,

Installed Nginx + PHP-FPM (centminmod). There is no apache.

The question arises, where to get instructions for nginx, which are written in htaccess.txt files. I don’t know how to translate Apache instructions into nginx instructions. Can someone give their settings?

OpenCart2.3
Nginx Version: 1.17.3
PHP 5.6.40
Centos7
Centminmod

Thanks
Last edited by 00001 on Sun Sep 08, 2019 10:03 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 07, 2019 2:58 am

Post by johnmario » Sat Sep 07, 2019 1:43 pm

Code: Select all

server {
    listen 80;
    listen [::]:80;

    root /var/www/kinbuweb/public;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name kinbu.localhost;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }
    location ~ /\.ht {
        deny all;
    }
}
Last edited by straightlight on Sat Apr 04, 2020 5:04 pm, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Sat Sep 07, 2019 1:37 pm

Post by 00001 » Sun Sep 08, 2019 9:59 am

Let's try.

Code: Select all

location / { try_files $uri @opencart;  }
location ~* ^/admin/cron/ { allow 127.0.0.1; deny all; }
location ~* ^/system/ { allow 127.0.0.1; deny all; }
location ~* \/\.ht { 		deny all;	}
location ~* (\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt) { 		deny all; 	}
location ~* \/\.git {		deny all;	}
location ~* \/image.+(\.php) {       		deny all;	}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {		expires max;		log_not_found off;	}
location = /sitemap.xml {		rewrite ^(.*)$ /index.php?route=extension/feed/google_sitemap last;	}
location = /googlebase.xml {	    rewrite ^(.*)$ /index.php?route=extension/feed/google_base last;	}
location /system {	    rewrite ^/system/storage/(.*) /index.php?route=error/not_found last;	}
location = /favicon.ico {		log_not_found off;		access_log off;	}
location = /robots.txt {		allow all;		log_not_found off;		access_log off;	}
location /admin { index index.php; }
location @opencart { rewrite ^/(.+)$ /index.php?_route_=$1 last; 	}
any opinions?

Newbie

Posts

Joined
Sat Sep 07, 2019 2:58 am

Post by superthin » Sat Apr 04, 2020 2:38 pm

I don't know why 404 JS and CSS all times. This helps me solve the problem.
Thank you so much! You really saved my day.

Newbie

Posts

Joined
Sat Mar 28, 2020 1:44 pm
Who is online

Users browsing this forum: No registered users and 6 guests