nginx如何配置虚拟主机

server  
    {  
        listen 80;  
        #listen [::]:80 default_server ipv6only=on;  
        server_name local.presion.caomall.net;  
        index index.html index.htm index.php;  
        root  /home/wwwroot/default/precision/Public;  
  
        #error_page   404   /404.html;  
        include enable-php-pathinfo.conf;  //注意这里从  nginx.conf 复制过来,如果不修改这里,主入口文件不支持require
  
        location /nginx_status  
        {  
            stub_status on;  
            access_log   off;  
        }  
  
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$  
        {  
            expires      30d;  
        }  
  
        location ~ .*\.(js|css)?$  
        {  
            expires      12h;  
        }  
  
        location ~ /\.  
        {  
            deny all;  
        }  
  
        access_log  /home/wwwlogs/access.log;  
    }  

  

猜你喜欢

转载自www.cnblogs.com/pansidong/p/9161782.html
今日推荐