2016-06-21 127 views
1

如果我連接www.my-hsot.com,則始終輸出'Hello!' Text ..無法修改nginx index.html文件

但是我的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)is:

<!DOCTYPE html> 
<html> 
<head> 
<title>Welcome to nginx!</title> 
<style> 
    body { 
     width: 35em; 
     margin: 0 auto; 
     font-family: Tahoma, Verdana, Arial, sans-serif; 
    } 
</style> 
</head> 
<body> 
<h1>Welcome to nginx!</h1> 
<p>If you see this page, the nginx web server is successfully installed and 
working. Further configuration is required.</p> 

<p>For online documentation and support please refer to 
<a href="http://nginx.org/">nginx.org</a>.<br/> 
Commercial support is available at 
<a href="http://nginx.com/">nginx.com</a>.</p> 

<p><em>Thank you for using nginx.</em></p> 
</body> 
</html> 

回答

2

你已設置

root /home/me; 
index index.php index.html index.htm; 
... 
location/{ 
    try_files $uri $uri/ /index.php?$request_uri; 
} 

所以,當訪問/ nginx的將首先查找其傳遞給FCGI處理程序的index.php。我想這就是「你好!」的地方來自:你的index.php。

如果沒有index.php,它會查找index.html,但是在文檔根目錄/ home/me中。

爲了得到一個空白頁上/你可以使用類似的目錄index.php文件

location ~ "^[/]?$" { 
    return 200; 
} 
+0

'/家庭/ me'是不存在的... –