farmer6 发表于 2011-8-17 23:44:03

301后一个很奇怪的问题,地址尾部加“/”与否会导致子目录路径错误 标题长一点 实在太奇怪了!

标题长了点,呵呵
还请能进来本帖的朋友帮忙分析一下
访问
http://1986y.net/phpmyadmin

http://1986y.net/phpmyadmin/
是两个完全不同的效果 后面加上/才能正常的访问 不加/虽然也可以 但是本应该在子目录里的路径 统统都会到父目录里
这个有点抽象是吧?大家点一下地址就知道了
当我单独用IP地址访问的时候 加或者不加/在地址后面 效果是一样的
大家可以对比一下
http://174.139.84.98/phpmyadmin

http://174.139.84.98/phpmyadmin/

这样就是没区别的

这是为什么呢?是不是/usr/local/nginx/conf/vhost/1986y.net.conf的配置文件有问题呢?

我贴一下..大家帮忙看看server
{
listen 80;
server_name 1986y.net;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/1986y;

include wordpress.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*\.(js|css)?$
{
expires 12h;
}

log_format 1986y.net '$remote_addr - $remote_user [$time_local] $request '
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';
access_log /home/wwwlogs/1986y.net.log 1986y.net;
}

[ 本帖最后由 farmer6 于 2011-8-17 23:49 编辑 ]

farmer6 发表于 2011-8-17 23:45:19

我的是www.1986y.net地址301到1986y.net上
我给www.1986y.net.conf的配置信息也贴一下


server {
                listen       80;
                server_name www.1986y.net;
                index index.html index.htm index.php default.html default.htm default.php;
                root/home/wwwroot/1986y;
                include none.conf;
                location ~ .*\.(php|php5)?$
                        {
                              fastcgi_passunix:/tmp/php-cgi.sock;
                              fastcgi_index index.php;
                              include fcgi.conf;
                        }
                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                              expires      30d;
                        }
                location ~ .*\.(js|css)?$
                        {
                              expires      12h;
                        }
                access_log off;
      }
server {
                listen       80;
                server_name www.1986y.net;
                if ($host != '1986y.net' ) {
                rewrite ^/(.*)$ http://1986y.net/$1 permanent;
                }

licess 发表于 2011-8-18 09:26:21

https://www.vpser.net/manage/nginx-auto-add-slash.html

farmer6 发表于 2011-8-18 17:39:35

感谢军哥回复
但是我修改后 还是不行 reload和restart lnmp后到不行 我reboot服务器也是一样 求解..
userwww www;

worker_processes 1;

error_log/home/wwwlogs/nginx_error.logcrit;

pid      /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;

events
      {
                use epoll;
                worker_connections 51200;
      }

http
      {
                include       mime.types;
                default_typeapplication/octet-stream;

                server_names_hash_bucket_size 128;
                server_name_in_redirect off;
                client_header_buffer_size 32k;
                large_client_header_buffers 4 32k;
                client_max_body_size 50m;

                sendfile on;
                tcp_nopush   on;

                keepalive_timeout 60;

                tcp_nodelay on;

                fastcgi_connect_timeout 300;
                fastcgi_send_timeout 300;
                fastcgi_read_timeout 300;
                fastcgi_buffer_size 64k;
                fastcgi_buffers 4 64k;
                fastcgi_busy_buffers_size 128k;
                fastcgi_temp_file_write_size 256k;

                gzip on;
                gzip_min_length1k;
                gzip_buffers   4 16k;
                gzip_http_version 1.0;
                gzip_comp_level 2;
                gzip_types       text/plain application/x-javascript text/css application/xml;
                gzip_vary on;

                #limit_zonecrawler$binary_remote_addr10m;

server
      {
                listen       80;
                server_name 174.139.84.99;
                index index.html index.htm index.php;
                root/home/wwwroot;

                location ~ .*\.(php|php5)?$
                        {
                              fastcgi_passunix:/tmp/php-cgi.sock;
                              fastcgi_index index.php;
                              include fcgi.conf;
                        }

                location /status {
                        stub_status on;
                        access_log   off;
                }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                              expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                              expires      12h;
                        }

                log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
                access_log/home/wwwlogs/access.logaccess;
      }
include vhost/*.conf;

}

farmer6 发表于 2011-8-22 18:18:12

顶上去 ......
页: [1]
查看完整版本: 301后一个很奇怪的问题,地址尾部加“/”与否会导致子目录路径错误 标题长一点 实在太奇怪了!