index.php的任何查询 - nginx问题



我以为我的服务器上只有apache,但是我看到nginx在apache做之前抓到了一些查询...

我的.htaccess文件:

RewriteEngine On
RewriteRule ^.*$ index.php [NC,L]

但是当我去URL时

https://site.domain/folder/another/folder/file.png

我有404错误,而不是我的index.php-script的结果!

我试图通过多种方式改变我的nginx-config,所以它徒劳无功。

有:

server {
    server_name site.domain www.site.domain;
    charset off;
    index index.html index.php;
    disable_symlinks if_not_owner from=$root_path;
    include /etc/nginx/vhosts-includes/*.conf;
    include /etc/nginx/vhosts-resources/site.domain/*.conf;
    access_log /var/www/httpd-logs/site.domain.access.log;
    error_log /var/www/httpd-logs/site.domain.error.log notice;
    ssi on;
    return 301 https://$host:443$request_uri;
    set $root_path /var/www/www-root/data/www/site.domain;
    root $root_path;
    location / {
        location ~ [^/].ph(pd*|tml)$ {
            try_files /does_not_exists @fallback;
        }
        location ~* ^.+.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
            try_files $uri $uri/ @fallback;
        }
        location / {
            try_files /does_not_exists @fallback;
        }
    }
    location @fallback {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect http://127.0.0.1:8080 /;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        access_log off;
    }
    listen 77.777.7.777:80;
}
server {
    server_name ege2018.top www.site.domain;
    ssl_certificate "/var/www/httpd-cert/www-root/site.domain_le1.crtca";
    ssl_certificate_key "/var/www/httpd-cert/www-root/site.domain_le1.key";
    ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
    ssl_prefer_server_ciphers on;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
    charset off;
    index index.html index.php;
    disable_symlinks if_not_owner from=$root_path;
    include /etc/nginx/vhosts-includes/*.conf;
    include /etc/nginx/vhosts-resources/site.domain/*.conf;
    access_log /var/www/httpd-logs/site.domain.access.log;
    error_log /var/www/httpd-logs/site.domain.error.log notice;
    ssi on;
    set $root_path /var/www/www-root/data/www/site.domain;
    root $root_path;
    location / {
        location ~ [^/].ph(pd*|tml)$ {
            try_files /does_not_exists @fallback;
        }
        location ~* ^.+.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
            try_files $uri $uri/ @fallback;
        }
        location / {
            try_files /does_not_exists @fallback;
        }
    }
    location @fallback {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect http://127.0.0.1:8080 /;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        access_log off;
    }
    listen 77.777.7.777:443 ssl;
}

(我更改为隐藏域名和服务器IP)

请帮助我解决这个问题,我希望仅通过编辑nginx-config。

谢谢!

您是否可以同时访问Nginx和Apache HTTPD日志?访问URL时,tail -F两个日志文件。@fallback确实看起来像将请求发送到HTTPD如果找不到本地,请求到达HTTPD日志吗?您可能会发现index.php不是HTTPD期望找到它的地方。

我的坏!我实际上要访问它,实际上是访问的,但钥匙在那里。URL就像

site.domain/icons/...

,尽管.htaccess说明,但Apache转到自己的图标文件夹...

我触摸了apache config解决此问题 - 评论的别名/iCons/

最新更新