我們?cè)谧鲆恍┪募?wù)器的時(shí)候空凸,偶爾會(huì)考慮使用http來(lái)搞较解,雖然說(shuō)默認(rèn)的也ok蛹找,但是長(zhǎng)得有點(diǎn)丑,怎么辦呢哨坪? 一個(gè)字干S辜病!
首先你的網(wǎng)站長(zhǎng)這個(gè)屌樣子
原始
別人家網(wǎng)站長(zhǎng)的比你好看
ngx-fancyindex
怎么搞呢当编?非常簡(jiǎn)單
裝nginx么届慈,誰(shuí)不會(huì),是不是忿偷?嘿嘿嘿金顿,多加一個(gè)模塊而已,我們開(kāi)始鲤桥。
首先git拉一下ngx-fancyindex的模塊
[root@localhost home]# git clone https://github.com/aperezdc/ngx-fancyindex.git
Cloning into 'ngx-fancyindex'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 755 (delta 3), reused 4 (delta 0), pack-reused 741
Receiving objects: 100% (755/755), 223.81 KiB | 107.00 KiB/s, done.
Resolving deltas: 100% (429/429), done.
[root@localhost home]#
然后么揍拆,開(kāi)始安裝
[root@localhost home]# tar xvf nginx-1.10.1.tar.gz
[root@localhost home]# cd nginx-1.10.1/
[root@localhost nginx-1.10.1]# useradd -s /sbin/nologin -M www
[root@localhost nginx-1.10.1]# ./configure --user=www --group=www --add-module=../ngx-fancyindex/ --prefix=/home/nginx --with-http_stub_status_module --with-http_ssl_module
[root@localhost nginx-1.10.1]# make && make install
安裝完成后,我們搞套索引主題來(lái)
先隨便進(jìn)個(gè)目錄茶凳,然后git上拉個(gè)索引主題
[root@tmp-20180522-sys-kvm-c-03-890525692825 tmp]# git clone https://github.com/Naereen/Nginx-Fancyindex-Theme.git
Cloning into 'Nginx-Fancyindex-Theme'...
remote: Enumerating objects: 182, done.
remote: Total 182 (delta 0), reused 0 (delta 0), pack-reused 182
Receiving objects: 100% (182/182), 654.20 KiB | 131.00 KiB/s, done.
Resolving deltas: 100% (81/81), done.
[root@tmp-20180522-sys-kvm-c-03-890525692825 tmp]#
[root@tmp-20180522-sys-kvm-c-03-890525692825 tmp]# tree Nginx-Fancyindex-Theme/
Nginx-Fancyindex-Theme/
├── _config.yml
├── fancyindex.conf
├── HEADER.md
├── LICENSE
├── Nginx-Fancyindex-Theme-dark
│ ├── addNginxFancyIndexForm.js
│ ├── footer.html
│ ├── header.html
│ ├── jquery.min.js
│ ├── showdown.min.js
│ └── styles.css
├── Nginx-Fancyindex-Theme-light
│ ├── addNginxFancyIndexForm.js
│ ├── footer.html
│ ├── header.html
│ ├── HEADER.md
│ ├── jquery.min.js
│ ├── README.md
│ ├── showdown.min.js
│ └── styles.css
├── README.md
└── screenshots
├── Nginx-Fancyindex-Theme__example1.png
├── Nginx-Fancyindex-Theme__example2.png
├── Nginx-Fancyindex-Theme__example3.png
├── Nginx-Fancyindex-Theme__example4.png
├── Nginx-Fancyindex-Theme__example5.png
└── Nginx-Fancyindex-Theme__example6.png
3 directories, 25 files
[root@tmp-20180522-sys-kvm-c-03-890525692825 tmp]#
下載主題后嫂拴,我們看到里面有2套播揪,一套黑色,一套白色分別是
Nginx-Fancyindex-Theme-dark
Nginx-Fancyindex-Theme-light
然后將主題拷貝到網(wǎng)站目錄下
[root@tmp-20180522-sys-kvm-c-03-890525692825 tmp]# mv Nginx-Fancyindex-Theme/Nginx-Fancyindex-Theme-light /home/webapp/
然后配置下nginx筒狠,注意看下配置文件中的索引html指向
[root@localhost conf]# cat nginx.conf
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
fancyindex on;
fancyindex_exact_size off;
fancyindex_localtime on;
fancyindex_header "/Nginx-Fancyindex-Theme-light/header.html";
fancyindex_footer "/Nginx-Fancyindex-Theme-light/footer.html";
fancyindex_ignore "examplefile.html";
fancyindex_ignore "Nginx-Fancyindex-Theme-light";
fancyindex_name_length 255;
server {
listen 80;
server_name localhost;
location / {
root /home/webapp/;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
配置完成后猪狈,啟動(dòng)nginx 嗨吧