How to use OpenCart website with Nginx in Virtualmin

You have to configure the rewrite rule in the Nginx configuration file for OpenCart because Nginx does not use the access file.

Login to Virtualmin >> Webmin >> servers >> Nginx >> edit config file

Add the following code to the Nginx configuration file and you're done. Your site should work properly.

# START Rewrite rules

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;
if (!-f $request_filename) {
set $rule_3 1$rule_3;
}
if (!-d $request_filename) {
set $rule_3 2$rule_3;
}
if ($uri !~ ".*.(ico|gif|jpg|jpeg|png|js|css)") {
set $rule_3 3$rule_3;
}
if ($rule_3 = "321") {
rewrite ^/([^?]*) /index.php?_route_=$1 last;
}

# END Rewrite rules

Note: Download the backup of your Nginx config file before making changes and restart the Nginx service after the changes.

 
 
  • Nginx, Virtualmin, OpenCart
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to increase PHP memory limit in virtualmin

To increase the PHP memory limit in Virtualmin, do the following:   1. Log into Virtualmin...

How to change password of Virtualmin

Please follow the below steps to change the password of the Virtualmin Admin. Login to...

How to create an email account in Virtualmin

To create an email account in Virtualmin, do the following: logged into Virtualmin. Choose...

How to install FREE SSL certificate in Virtualmin

Please follow the below steps to install a FREE SSL certificate in Virtualmin. 1. logged into...

How to run Cron job manually in Virtualmin

Please follow the below steps to run the run cron job manually in Virtualmin.   Login to...

Powered by WHMCompleteSolution