Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.4k views
in Technique[技术] by (71.8m points)

nginx配置完成,项目也部署完成了,访问首页正常,其它页面显示“无法访问此网站,拒绝了我们的连接请求”

服务器:腾讯云的香港服务器,系统是Ubuntu18.04的
项目主要是用PHP框架Laravel写的
问题描述:部署完成之后是可以访问首页的,其它页面不能访问,显示下图信息
image
nginx配置:

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html/book/public;

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

    server_name _;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

做过的尝试:

  • 添加try_files $uri $uri/ /index.php?$query_string;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

最后查了一下nginx的日志,之前一直在error.log里看有没有错误信息,后来想着要不在access.log里瞅一下,然后就发现了下边的十六进制的信息,最后有个400的错误码

x16x03x01x02x00x01x00x01xFCx03x03x85x90xA7xD8x06x88$xCAxCFx8E$xBD |x22xAA8!xE4{x16bxB5xFD,xF9xA3(xCA'Im xA5xF6xA3xAFxFAxCBhxEC'xC6x05;ExFCLxC5;xEBx84xA3ExFB@>xE4x1B$KlxD7nXx00x22ZZx13x01x13x02x13x03xC0+xC0/xC0,xC00xCCxA9xCCxA8xC0x13xC0x14x00x9Cx00x9Dx00/x005x00" 400 182 "-" "-"

后来一看,是请求的方式不对,应该是http://ip:端口,我整成https://ip:端口了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...