nginx 访问静态html 方式

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u010363836/article/details/50380260

例子1:

# Dapeng School Configuration.
upstream www.dapengjiaoyu.cn {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name www.dapengjiaoyu.cn;
    index index.html index.htm;
    charset utf-8;
    client_max_body_size    1000m;
    
    
    #expires 24h;
 
    location / {

	root /home/workspace/dapeng/src/main/webapp/pagezhuangti/;
        index jiuye.html;  
    }
    
    # deny access hidden files.
    location ~ /\. { deny all; access_log off; log_not_found off; }
        
}

例子2:

# Dapeng School Configuration.
upstream www.dapengedu.cn {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name www.dapengedu.cn;
    index 2016sheji.html;
    charset utf-8;
    client_max_body_size    1000m;
    
    
    #expires 24h;
 
    location / {

	root /home/workspace/dapeng/src/main/webapp/pagezhuangti/;
        index 2016sheji.html;

    }

}

两个例子应该可以合并写成一个配置文件的,

根据域名的不同,访问不同的目录,小编没研究过0_0

猜你喜欢

转载自blog.csdn.net/u010363836/article/details/50380260