老師,請問這是怎么實現(xiàn)的???問題如下Σ(?∀??)?
老師,請問在訪問網(wǎng)站(比如www.abc.com)其他頁面時(比如test文件夾下的test.html),地址欄結(jié)尾并沒有顯示被訪問的那個.html或.php文件(www.abc.com/test/test.html),而是域名加文件名的形式(www.abc.com/test/)是怎么實現(xiàn)的啊
老師,請問在訪問網(wǎng)站(比如www.abc.com)其他頁面時(比如test文件夾下的test.html),地址欄結(jié)尾并沒有顯示被訪問的那個.html或.php文件(www.abc.com/test/test.html),而是域名加文件名的形式(www.abc.com/test/)是怎么實現(xiàn)的啊
2018-07-13
舉報
2018-07-16
我不是大佬=。=,也是才開始學習的;
如果非要在/etc/nginx/nginx.conf配置的話我是這樣做的:http里加server,注釋掉其中的include...:
#? ? include /etc/nginx/conf.d/*.conf;????--注釋掉這個,不然他會加載這個目錄下面配置文件。
server {
? ? listen? ? ? ?80;
? ? server_name? localhost;
? ? location / {
? ? ? ? root? ?/usr/share/nginx/html;
? ? ? ? index? index.html index.htm;
? ? }
? ? location /test {
? ? ? ? alias? /root/www/test;
? ? ? ? index? test.html;?
? ? ? ? }
}
把網(wǎng)頁文件test.html放到?/root/www/test/下面。訪問http://ip/test
把網(wǎng)頁文件index.html放到?/usr/share/nginx/html下面。訪問http://:ip即可;
祝你順利
2018-07-16
可以在/etc/nginx/conf.d/default.conf 的server 里添加
location /test {
? ? ? ? alias? ?/root/www/html;
? ? ? ? index? test.html;
}