linux环境下vhost的.conf的好用范例

该范例 需要修改以下几点:
server_name -> aaa.bbb.com改为自己的域名
ssl_certificate ssl_certificate_key 改为自己的ssl证书

server {
     
    listen  80;
    server_name aaa.bbb.com;
    rewrite ^(.*)$  https://$host$1 permanent;
}
server {
     
    listen 443 ssl http2;
    server_name aaa.bbb.com;
    index index.html index.htm index.php default.html default.htm default.php;
    root  /home/wwwroot/example/api/frontend/web;
    server_tokens off;
    ssl_certificate /usr/local/nginx/conf/cert/1111111__bbb.com.pem;
    ssl_certificate_key /usr/local/nginx/conf/cert/1111111__bbb.com.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
    ssl_session_cache builtin:1000 shared:SSL:10m;

    include enable-php-pathinfo.conf;
    include rewrite/yii2.conf;
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
     
        expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
     
        expires      12h;
    }
    location ~ /.well-known {
     
        allow all;
    }
    location ~ /\.
    {
     
        deny all;
    }
    access_log  /home/wwwlogs/aaa.bbb.com.access.log;
    error_log /home/wwwlogs/aaa.bbb.com.error.log error;
}

你可能感兴趣的:(vhost配置,nginx,linux,lnmp)