nginx配置文件重写问题

nginx配置文件重写问题

我的客户转移到带有 nginx 和 percona 服务器的新服务器。问题是正斜杠已从 url 末尾删除。参考图片 https://i.stack.imgur.com/6wTGZ.jpg

因此设计文件如js,CSS文件未加载或出现 magento 404 未找到页面,并且它是随机发生的。

在数据库上web/unsecure/base_urlweb/secure/base_url用正斜杠设置http://78.137.115.47.srvlist.ukfast.net/

我假设 nginx conf 文件有问题。重写规则可能是错误的。我已经尝试了在这个网站和谷歌上可以找到的所有可能的方法,但没有任何效果。可能是别的东西。能否请你帮忙?

这是该域的 nginx conf 文件

# Uncomment the server definition below should you wish to
# redirect from punkyfish.com to www.punkyfish.com
#server {
#    listen 192.168.92.247;
#    server_name punkyfish.com;
#    #rewrite / $scheme://www.$host$request_uri permanent;
#}

#
# Change this backend name (and the socket pointer)
# as additional virtual hosts are added. This should
# point to the spawn-fcgi wrapper running as the
# appropriate user.
#
upstream punkyfishcombackend {
        server unix:/var/run/php-fcgi-punkyfishcom.sock;
}

server {
    listen 192.168.92.247:80;
    server_name punkyfish.com;
    root /var/www/vhosts/punkyfish.com/htdocs;

    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
        expires 30d;
    }

    location /app/                { deny all; }
    location /includes/           { deny all; }
    location /lib/                { deny all; }
    location /media/downloadable/ { deny all; }
    location /pkginfo/            { deny all; }
    location /report/config.xml   { deny all; }
    location /var/                { deny all; }

    location  /. {
        return 404;
    }

    location @handler {
       rewrite / /index.php;
    }

    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    include "ssl_offloading.inc";
    location ~ .php$ {
        if (!-e $request_filename) { rewrite / /index.php last; }

        expires        off;
        fastcgi_pass   punkyfishcombackend;
        fastcgi_param  HTTPS $fastcgi_https;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
#       fastcgi_param  MAGE_RUN_CODE default;
#       fastcgi_param  MAGE_RUN_TYPE store;
        include        fastcgi_params;
    }

答案1

这是因为 nginx 缓存了所有内容。无论我对数据库和文件的更改都没有反映出来。我从 ngnix 缓存文件夹中清理了缓存并解决了问题。

谢谢。

相关内容