lomg 发表于 2018-11-9 12:57:05

nginx相同端口多站点配置

# vi aa.com.conf  
error_log/home/wwwlogs/nginx_error.logcrit;
  
#Specifies the value for maximum file descriptors that can be opened by this process.
  
server
  
    {
  
      listen 80;      #端口
  
      #listen [::]:80 default_server ipv6only=on;
  
      server_name www.aa.com;      #域名
  
      index index.html index.htm index.php;
  
      root/home/wwwroot/default;      #访问跟目录
  
      #error_page   404   /404.html;
  
      include enable-php.conf;
  
      location /nginx_status
  
      {
  
            stub_status on;
  
error_log/home/wwwlogs/nginx_error.logcrit;
  
#Specifies the value for maximum file descriptors that can be opened by this process.
  
server
  
    {
  
      listen 80;
  
      #listen [::]:80 default_server ipv6only=on;
  
      server_name www.aa.com;
  
      index index.html index.htm index.php;
  
      root/home/wwwroot/default;
  
      #error_page   404   /404.html;
  
      include enable-php.conf;
  
      location /nginx_status
  
      {
  
            stub_status on;
  
            access_log   off;
  
      }
  
      location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  
      listen 80;
  
      #listen [::]:80 default_server ipv6only=on;
  
      server_name www.aa.com;
  
      index index.html index.htm index.php;
  
      root/home/wwwroot/default;
  
      #error_page   404   /404.html;
  
      include enable-php.conf;
  
      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.logaccess;
  
    }


页: [1]
查看完整版本: nginx相同端口多站点配置