server {
listen 80;
server_name butian.me;
rewrite ^/(.*)$ https://$host/$1 permanent;
}

server {

listen 80;
root /var/www/sites/butian;
server_name www.butian.me ;
index index.php index.html;
access_log  /var/log/nginx/butian.access.log;
error_log   /var/log/nginx/butian.error.log warn;

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
    fastcgi_index  index.php;
    fastcgi_param PATH_INFO       $fastcgi_path_info;
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
    include        fastcgi_params;
}

location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {

    expires 3y;
    access_log off;
    gzip off;
}

location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
    add_header Access-Control-Allow-Origin *;
    expires 3y;
    access_log off;
    gzip off;
}

location ~ /\.ht {
    deny  all;
}

}

Tagged:

发表评论

电子邮件地址不会被公开。 必填项已用*标注