首先你的網(wǎng)站是這個樣子
別人家網(wǎng)站長的比你好看
首先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]#
然后么,開始安裝nginx
- [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]# ./configure --add-module=../ngx-fancyindex/ --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
- [root@localhost nginx-1.10.1]# make && make install
安裝完成后,我們搞套索引主題來
- 先隨便進(jìn)個目錄,然后git上拉個索引主題
- [root@tmp 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.
下載主題后,我們看到里面有2套,一套黑色,一套白色分別是
Nginx-Fancyindex-Theme-dark
Nginx-Fancyindex-Theme-light
然后將主題拷貝到網(wǎng)站目下
- [root@tmp-tmp]# mv Nginx-Fancyindex-Theme/Nginx-Fancyindex-Theme-light /home/
然后配置下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/;
- index index.html index.htm;
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root html;
- }
- }
- }
配置完成后,啟動nginx
注意:重啟需要先停止,再啟動方可生效?。?!
更多相關(guān)文章
版權(quán)聲明:文章圖片資源來源于網(wǎng)絡(luò),如有侵權(quán),請留言刪除!!!
評論