Post by magzen » Tue May 19, 2020 2:48 pm


I hired someone to fix the redirect 301 for me, he had to separate the multidomains aliases in 3 nginx config files for the redirection to work properly, but at the same time this broke the Vestacp web control for the domains, since Vestacp works with 1 file when aliases are added, i had to renew letsencrypt using ssh instead.

the following command had some issues return 301 https://www.$server_name$request_uri;

Code: Select all would not redirect to would not redirect to would not redirect to

Code: Select all redirects to (main store) redirects to (main store)
the only thing that is working correctly with the command https://www.$server_name$request_uri;

Code: Select all redirects to
the guy i hired used the following command return 301 https://www.$host$request_uri; in 3 files that made redirection work properly

using it in 1 file also created issues like

Code: Select all redirects to redirects to redirects to

Code: Select all dont redirect to dont redirect to dont redirect to
the redirection change was made in the file nothing changed in

You can check the configurations

Code: Select all

server {
    listen      XX.XX.XX.XX:80;
return 301 https://www.$host$request_uri;    
root        /home/admin/web/;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/ combined;
    access_log  /var/log/nginx/domains/ bytes;
    error_log   /var/log/nginx/domains/ error;
location /multiscraper/ {
		try_files $uri $uri/ /multiscraper/index.php?$args;
    location / {
        try_files $uri $uri/ @opencart;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;

            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;

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

    location /vstats/ {
        alias   /home/admin/web/;
        include /home/admin/conf/web/*;

    error_page  403 /error/404.html;
    error_page  404 /error/404.html;
    error_page  500 502 503 504 /error/50x.html;

    location /error/ {
        alias   /home/admin/web/;

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;

    include     /etc/nginx/conf.d/*;
    include     /etc/nginx/conf.d/*;
    include     /etc/nginx/conf.d/*;

    include     /home/admin/conf/web/*;

Would appreaciate if someone have a solution and can help solve this issue

Active Member


Tue Jun 05, 2012 7:04 pm

Post by neuron » Sat Sep 05, 2020 12:21 am

Thank you for sharing this, I do not know anything about nginx configuration, you shared config helped me in my project



Wed Aug 12, 2020 5:40 pm
Who is online

Users browsing this forum: No registered users and 7 guests