Odd behavior

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Odd behavior

Ken Wright
Sorry to be taking up so much bandwidth lately, but I'm seeing some
weird behavior from nginx.

When I enter my domain name in Firefox, I get a 404 status.  If I enter
<domain>.com/index.nginx-debian.html I get the regular nginx welcome
screen.  Just for fun I copied index.nginx-debian.html to index.html,
and <domain>.com/index.html gets an "Opening index.php" window.  This
one in particular has me stumped, because index.html and
index.nginx-debian.html are identical, but the show different behavior.

Like I said, weird.  Has anyone else seen anything like this?

Ken

--

Registered Linux user #483005

If you ever think international relations make sense, remember this:  
because a Serb shot an Austrian in Bosnia, Germany invaded Belgium.

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Odd behavior

Peter Booth
Is your web server on the internet? If so then see what redbot shows. It’s an amazing tool to debug nuanced http issues

Sent from my iPhone

> On Oct 9, 2019, at 1:52 AM, Ken Wright <[hidden email]> wrote:
>
> Sorry to be taking up so much bandwidth lately, but I'm seeing some
> weird behavior from nginx.
>
> When I enter my domain name in Firefox, I get a 404 status.  If I enter
> <domain>.com/index.nginx-debian.html I get the regular nginx welcome
> screen.  Just for fun I copied index.nginx-debian.html to index.html,
> and <domain>.com/index.html gets an "Opening index.php" window.  This
> one in particular has me stumped, because index.html and
> index.nginx-debian.html are identical, but the show different behavior.
>
> Like I said, weird.  Has anyone else seen anything like this?
>
> Ken
>
> --
>
> Registered Linux user #483005
>
> If you ever think international relations make sense, remember this:  
> because a Serb shot an Austrian in Bosnia, Germany invaded Belgium.
>
> _______________________________________________
> nginx mailing list
> [hidden email]
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Odd behavior

Francis Daly
In reply to this post by Ken Wright
On Wed, Oct 09, 2019 at 01:52:11AM -0400, Ken Wright wrote:

Hi there,

> When I enter my domain name in Firefox, I get a 404 status.

Do your nginx logs show this request getting to nginx?

If not, there is something outside of nginx that needs changing first.

Perhaps if you test using "curl", that will eliminate any possibility of
browser-side caching interfering in your tests.

> If I enter
> <domain>.com/index.nginx-debian.html I get the regular nginx welcome
> screen.  Just for fun I copied index.nginx-debian.html to index.html,
> and <domain>.com/index.html gets an "Opening index.php" window.  This
> one in particular has me stumped, because index.html and
> index.nginx-debian.html are identical, but the show different behavior.

If your configuration includes something like

  location = /index.html { return 200 "Opening index.php\n"; }

that might explain that difference.

Your configuration probably does not include that location{} block;
but only you know for sure.


On your test system where you can replicate this unwanted behaviour:
how many lines from the config can you remove, and still see the issue?

If you can show a (small) config that someone else can use to see the
issue, perhaps it will be clear what needs to be changed.

Cheers,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Odd behavior

Ken Wright

On 10/9/19 4:27 AM, Francis Daly wrote:
> On Wed, Oct 09, 2019 at 01:52:11AM -0400, Ken Wright wrote:
>
> When I enter my domain name in Firefox, I get a 404 status.
> Do your nginx logs show this request getting to nginx?
>
> If not, there is something outside of nginx that needs changing first.
I'm sure I'm getting to nginx; the 404 message shows nginx as well.
> Perhaps if you test using "curl", that will eliminate any possibility of
> browser-side caching interfering in your tests.
I tried using curl on both index.html and index.nginx-debian.html and
got identical results for both.
>
> If you can show a (small) config that someone else can use to see the
> issue, perhaps it will be clear what needs to be changed.

Okay, here's the default config:


# Default server configuration
#
upstream php-handler {
    server unix:/run/php/php7.2-fpm.sock;
}

server {
    if ($host = www.koalatyworks.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    if ($host = koalatyworks.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

    listen 80;
    listen [::]:80;
        server_name koalatyworks.com www.koalatyworks.com;

    # SSL configuration
    #
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
        server_name koalatyworks.com www.koalatyworks.com;
    #

    root /var/www/html;

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

    return 301 https://$host$request_uri;
        ssl_certificate
/etc/letsencrypt/live/koalatyworks.com/fullchain.pem; # managed by Certbot
        ssl_certificate_key
/etc/letsencrypt/live/koalatyworks.com/privkey.pem; # managed by Certbot


    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }
}


I hope that helps!

Ken

--
Registered Linux user #483005

If you ever think international relations make sense, remember this:  
because a Serb shot an Austrian in Bosnia, Germany invaded Belgium.

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Odd behavior

Francis Daly
On Wed, Oct 09, 2019 at 07:53:44PM -0400, Ken Wright wrote:
> On 10/9/19 4:27 AM, Francis Daly wrote:
> > On Wed, Oct 09, 2019 at 01:52:11AM -0400, Ken Wright wrote:

Hi there,

> > If you can show a (small) config that someone else can use to see the
> > issue, perhaps it will be clear what needs to be changed.
>
> Okay, here's the default config:

> server {
>     if ($host = www.koalatyworks.com) {
>         return 301 https://$host$request_uri;
>     } # managed by Certbot
>
>     if ($host = koalatyworks.com) {
>         return 301 https://$host$request_uri;
>     } # managed by Certbot

[snip]

>     root /var/www/html;
>     return 301 https://$host$request_uri;

When using this config, is there one request that you can make that
responds with something other than a http 301?

I think that you said you get a 404, and maybe two different 200s.

So I'm going to say that, using the config that you provide, I am unable
to replicate the issue that you report.

Perhaps I'm using a different version of nginx. Or perhaps the config
that was in place when you saw the issue, is not the config that is here.

Cheers,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx