Can';t修改nginx index.html文件
如果我连接Can';t修改nginx index.html文件,nginx,Nginx,如果我连接www.my-hsot.com,则始终输出“你好!”文本 但是我的index.html文件内容什么都不是。我只想要一张空白页。。 如何修改默认索引文件 这是我的默认配置: server { listen 80; root /home/me; index index.php index.html index.htm; server_name www.my-hsot.com; location / { try_files $ur
www.my-hsot.com
,则始终输出“你好!”文本
但是我的index.html文件内容什么都不是。我只想要一张空白页。。
如何修改默认索引文件
这是我的默认配置:
server {
listen 80;
root /home/me;
index index.php index.html index.htm;
server_name www.my-hsot.com;
location / {
try_files $uri $uri/ /index.php?$request_uri;
}
location /.well-known {
root /home/me/well-known;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_keep_conn on;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
这是nginx的默认索引文件(路径:/usr/share/nginx/html/index.html)是:
欢迎来到nginx!
身体{
宽度:35em;
保证金:0自动;
字体系列:Tahoma、Verdana、Arial、无衬线字体;
}
欢迎来到nginx!
如果您看到此页面,则nginx web服务器已成功安装,并且
工作需要进一步配置
有关在线文档和支持,请参阅
.
商业支持可从以下网址获得:
感谢您使用nginx
您已设置
root /home/me;
index index.php index.html index.htm;
...
location / {
try_files $uri $uri/ /index.php?$request_uri;
}
因此,在访问/nginx时,将首先查找传递给fcgi处理程序的index.php。我想这就是“Hello!”的来源:your index.php
如果没有index.php,它将在文档root/home/me中查找index.html
要在/上获得空白页,可以使用以下内容
location ~ "^[/]?$" {
return 200;
}
location ~ "^[/]?$" {
return 200;
}