nginx配置多个静态资源

#user  nobody;
worker_processes 4;

worker_cpu_affinity 0001 0010 0100 1000;


#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size  20m; 

    sendfile        on;
    keepalive_timeout  65;
    underscores_in_headers on;

    upstream fdfs_group1 {
        server 127.0.0.1:9011;
    }
    #gzip  on;

    server {
            listen       80;
            server_name dev.dongshanhaibao.com;     
            #charset koi8-r;

            #access_log  logs/host.access.log  main;
         rewrite ^(.*)$  https://$host$1 permanent;  
    }

       server {
            listen       443 ssl;
            server_name  dev.dongshanhaibao.com;

        ssl on;
               ssl_certificate      ssl/2844030_dev.dongshanhaibao.com.pem;
            ssl_certificate_key  ssl/2844030_dev.dongshanhaibao.com.key;
            ssl_session_cache    shared:SSL:5m;
            ssl_session_timeout  25m;

            ssl_ciphers  HIGH:!aNULL:!MD5;
            ssl_prefer_server_ciphers  on;

            location / {
                   # root   html;
                   # index  index.html index.htm;
             proxy_pass http://localhost:9002/;
                     proxy_set_header  Host  $http_host;
                
        }
        location /www1{    
                  alias /usr/share/nginx/html;
                  index index.html index.php index.htm;
          }
          location /www2{
                  alias /usr/share/nginx/dist;
                  index index.html index.php index.htm;
          }
        location /group1/M00 {
                 proxy_pass http://fdfs_group1;
        }
        location /adminw {
                        proxy_pass http://localhost:9001/;
                        proxy_set_header  Host  $http_host;
                }    
    }
}  

原文地址:https://www.cnblogs.com/aqicheng/p/11567161.html