模块控制器URL在Prestashop 1.7上不再起作用

时间:2018-09-26 16:16:47

标签: nginx module controller prestashop prestashop-1.7

我为prestashop 1.6站点开发了一个模块,效果很好!

我现在将其安装在另一个站点上,但安装在同一台服务器上(那里有多个其他站点),并且...出现了问题。

每当我尝试使用浏览器的URL栏访问模块的控制器时,都会重定向到其他站点之一的主模块控制器,而不是我的站点!

示例:

http://ps17.mysite.com/index.php?fc=module&module=mymodule&controller=payments

返回:500 Internal Server Error

https://ps17.mysite.com/index.php?fc=module&module=mymodule&controller=payments

只需重定向到具有prestashop 1.6的其他站点之一。

这是我的NGINX配置:

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

    root /usr/share/nginx/html/mysite;

    # Add index.php to the list if you are using PHP
    index index.html index.php index.htm index.nginx-debian.html;

    server_name mysite.com ps17.mysite.com;

    # Logs
    access_log /var/log/nginx/mysite.access.log;
    error_log /var/log/nginx/mysite.error.log;

    # Lets encrypt handshake
    location ~ /.well-known {
            allow all;
    }

    location = /robots.txt {
            auth_basic off;
            allow all;
            log_not_found off;
            access_log off;
        }

    # Gzip Settings
        gzip on;
        gzip_disable "msie6";
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 1;
        gzip_buffers 16 8k;
        gzip_http_version 1.0;
        gzip_types application/json text/css application/javascript;

        rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
        rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$1$2$3.jpg last;
        rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$1$2$3$4.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg last;
        rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg last;
        rewrite ^/c/([0-9]+)(-[.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+.jpg$ /img/c/$1$2$3.jpg last;
        rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+.jpg$ /img/c/$1$2.jpg last;
        rewrite ^/images_ie/?([^/]+).(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 last;
        rewrite ^/order$ /index.php?controller=order last;
        rewrite ^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$ /index.php?fc=module&module=$1&controller=$2 last;

    # Admin URL   
    location /admin-mysite/ {                           #Change this to your admin folder
            if (!-e $request_filename) {
                rewrite ^/.*$ /admin-mysite/index.php last; #Change this to your admin folder
            }

        # Timeout Settings
            proxy_read_timeout   3600;
        }

    # Blog URL
    location /blog/ {
        try_files $uri $uri/ /blog/index.php?$args;
    }

    location / {
            if (!-e $request_filename) {
                rewrite ^/.*$ /index.php last;
            }
    }   

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;

        #Timeout
        fastcgi_read_timeout 900;

        # With php7.0-cgi alone:
        # fastcgi_pass 127.0.0.1:9000;
        # With php7.0-fpm:
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    client_max_body_size 16M;
}

0 个答案:

没有答案