Re: Два location со статикой

darksmoke nginx-forum на forum.nginx.org
Вт Фев 6 13:42:52 UTC 2018


server {                                                                    
                                        
    server_name domain.ru;                                                  
                         
    listen 443 ssl;                                                         
                                        
                                                                            
                                        
    ssl_certificate       certs/domain.ru/fullchain3.pem;                   
                         
    ssl_certificate_key   certs/domain.ru/privkey3.pem;                     
                         
                                                                            
                                        
                                                                            
                                        
    location /v3/ {                                                         
                                        
        location ~* \.(xsl|ico|gif|png|svg|js|css|html|ttf|woff|json|xml)$ {
                                        
            index index.html;                                               
                                        
            root /opt/DATA/stat/otp24v3;                                    
                              
            expires -1;                                                     
                                        
        }                                                                   
                                        
    }                                                                       
                                        
                                                                            
                                        
    location / {                                                            
                                        
        location ~* \.(xsl|ico|gif|png|svg|js|css|html|ttf|woff|json|xml)$ {
                                        
            index index.html;                                               
                                        
            access_log off;                                                 
                                        
            root /opt/DATA/stat/otp24;                                      
                              
            expires -1;                                                     
                                        
        }                                                                   
                                        
    }                                                                       
                                        
                                                                            
                                        
                                                                            
                                        
                                                                            
                                        
    location /api/ {                                                        
                                        
        proxy_pass http://10.56.2.225:8080/otp/api/;                        
                                        
        proxy_set_header Host $host;                                        
                                        
        proxy_set_header X-Real-IP $remote_addr;                            
                                        
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        
                                        
                                                                            
                                        
        access_log  /opt/nginx/logs/now/domain.ru.access.log up_log;        
                                       
        error_log   /opt/nginx/logs/domain.ru.error.log;                    
                                       
                                                                            
                                        
    }                                                                       
                                        
                                                                            
                                        
}

Posted at Nginx Forum: https://forum.nginx.org/read.php?21,278376,278379#msg-278379



Подробная информация о списке рассылки nginx-ru