Nginx问题总结(1)

    科技2025-01-09  22

    一、解决Nginx make: *** No rule to make target `build', needed by `default'. Stop.

    (1)先将之前的make clean

    (2)安装下面配置

    yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel

    (3) 重新configure

    ./configure

    (4) 编译

    make && make install

    二、HTTP Error 404.The requested resource is not found.

    原因是因为端口被占用。

    (1)打开conf文件夹(G:\software\nginx-1.12.2\conf)

    (2)打开nginx.conf

     (3)修改端口

     

    (4)用命令关闭并重新启动

    (5)在浏览器输入地址即可

    http://localhost:10001/

    三、An error occurred.

     

    问题:

    2020/10/07 21:26:49 [crit] 8964#22844: *2 GetFileAttributesEx() "G:\software

    ginx-1.12.2\static" failed (123: The filename, directory name, or volume label syntax is incorrect), client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:10001"

    原因:windows和linux不一样,windows中默认是反斜杠\\\,而linux确实斜杠// ,结果路径中的

    G:\software ginx-1.12.2\static        \n就会被当做换行,被转移处理

    解决方案:配置资源目录的时候,            root   G:\software\\nginx-1.12.2\static; 双反斜杠表示不转义,如果是linux就不会存在这个问题。

    四、403 Forbidden

    directory index of “xxx“ is forbidden

     

    原因:直接使用IP地址和端口号访问时,需要指定index,如果未指定,出现该报错。

    添加上autoindex on就可以了

    Processed: 0.013, SQL: 8