Forum: NGINX Do nginx do not auto differentiate the file name and directory name in the url?

Posted by ultrawind (Guest)
on 2010-02-27 10:33
(Received via mailing list)
I 'm sorry for my bad english, i hope you can help me.

I already setup the nginx and php.

while i visit "http://localhost/myweb"

the server return "Internet Explorer cannot display the webpage"

while i visit "http://localhost/myweb/"

then i can visit naturaly.


how can i solve this problem?

Should i config the nginx.conf file ?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,57890,57890#msg-57890
Posted by Edho P Arief (Guest)
on 2010-02-27 11:46
(Received via mailing list)
On Sat, Feb 27, 2010 at 4:32 PM, ultrawind <nginx-forum@nginx.us> wrote:
> then i can visit naturaly.
>
>
> how can i solve this problem?
>
> Should i config the nginx.conf file ?
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,57890,57890#msg-57890
>
>

please post your config


--
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
Posted by Vicente Aguilar (Guest)
on 2010-02-28 08:39
(Received via mailing list)
Hi

You mean something like Apache's mod_dir's DirectorySlash. I've just 
tried and it works atomatically for me on a clean nginx install, no need 
to configure anything.

When you visit localhost/myweb, besides IE giving an error, does the 
address turn to "myweb/" or not? Is nginx correctly issuing the HTTP 301 
redirect? Can you try with Firefox and the LiveHTTPHeaders extension and 
verify this?

Could you post your config?

Regards

El 27/02/2010, a las 10:32, ultrawind 
escribió:
> then i can visit naturaly.
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

--
  Vicente Aguilar <bisente@bisente.com> | http://www.bisente.com
Posted by ultrawind (Guest)
on 2010-03-01 03:52
(Received via mailing list)
dear all, i use Firefox to visit "http://localhost/myweb" , is also do 
not work.
here is my nginx.conf
user  daemon;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    server_tokens off;

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /home/httpd/html;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # pass the PHP scripts to FastCGI server listening on 
127.0.0.1:9000

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME 
/home/httpd/html/$fastcgi_script_name;
            include        fastcgi_params;
        }

    }

}



here is the access.log record result
fail
192.168.1.19 - - [01/Mar/2010:10:42:33 +0800] "GET /myweb HTTP/1.1" 301 
178 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trid
ent/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
3.5.21022)"
success
192.168.1.19 - - [01/Mar/2010:10:44:18 +0800] "GET /myweb/ HTTP/1.1" 200 
45696 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; 
Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
3.5.21022)"

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,57890,58466#msg-58466
Posted by Vicente Aguilar (Guest)
on 2010-03-01 07:49
(Received via mailing list)
Hi

> 192.168.1.19 - - [01/Mar/2010:10:42:33 +0800] "GET /myweb HTTP/1.1" 301 178 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trid
> ent/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)"

nginx seems to be issuing the 301 HTTP redirect redirect, notice the 301 
after the GET.

What's your URL after you go to http://domain/myweb and get the error? 
According to that log you've received a redirect and it should have 
changed to http://domain/myweb/. Does it show domain or localhost? 
You're using localhost as the server_name, I'm not sure if maybe nginx 
is using that domain to issue the Location on the redirect. If you're 
testing this from a different machine than your server it will sure 
fail.

Please try with the LiveHTTPHeaders Firefox plugin and tell us what 
Location: are you being redirected to on the HTTP 301.

Regards

--
  Vicente Aguilar <bisente@bisente.com> | http://www.bisente.com
Posted by ultrawind (Guest)
on 2010-03-02 03:29
(Received via mailing list)
hello,Vicente Aguilar,
thank you for your helping.I found the point by the LiveHTTPHeaders 
Firefox plugin  .
i set the server_name localhost to 192.168.1.124;Then it's work now.


this is the result:
http://192.168.1.124/myweb

GET /homekoo.com HTTP/1.1
Host: 192.168.1.124
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2) 
Gecko/20100115 Firefox/3.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie: visit_level=2; db_=idsYt7hyLPjGct%2Bh8MfNpErRnk2t9T9D6Vf4iJ4; 
others=2NkY5OwkK6n%2FSYfB8Ao; rtime=4; ltime=1267496256399; 
cnzz_eid=39895488-1264743989-; 
__utma=81186391.1499015929.1265772641.1267411366.1267496256.3; 
__utmz=81186391.1265772641.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); 
Hm_lvt_7cb1f2f2baf6ab2ae929ad8cb88d6210=1265772641278; cnzz_a485651=0; 
sin485651=; cnzz_a977997=0; sin977997=; cnzz_a1366560=0; sin1366560=; 
__utmb=81186391; __utmc=81186391; _SID=6e46d49d85cf0da3b88eac61b6a3edd1

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 02 Mar 2010 02:16:21 GMT
Content-Type: text/html
Content-Length: 178
Location: http://localhost/myweb/
Connection: keep-alive
----------------------------------------------------------

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,57890,58862#msg-58862
Posted by Igor Sysoev (Guest)
on 2010-03-02 15:56
(Received via mailing list)
On Mon, Mar 01, 2010 at 09:29:35PM -0500, ultrawind wrote:

> hello,Vicente Aguilar,
> thank you for your helping.I found the point by the LiveHTTPHeaders Firefox plugin  .
> i set the server_name localhost to 192.168.1.124;Then it's work now.
> 

You should either set "server_name_in_redirect off" or set server_name
to the requested domain name.

> Keep-Alive: 115
> ----------------------------------------------------------
> 
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,57890,58862#msg-58862
> 
> 
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

--
Igor Sysoev
http://sysoev.ru/en/
Posted by ultrawind (Guest)
on 2010-03-04 09:04
(Received via mailing list)
i got it, thank you.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,57890,59829#msg-59829
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.