博客主题导入成功后,配置代理,我的配置如下
server {
listen 80;
server_name www.shmaur.com shmaur.com;
client_max_body_size 500m;
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
if ( $host != 'www.shmaur.com' ) {
rewrite ^(.*)$ https://www.shmaur.com permanent;
}
location =/ {
proxy_pass http://127.0.0.1:端口/share/index.html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
location / {
proxy_pass http://127.0.0.1:端口;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
}
server {
listen 443 ssl;
server_name www.shmaur.com shmaur.com;
client_max_body_size 500m;
ssl_certificate 证书完整路径;
ssl_certificate_key 证书完整路径;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:HIGH:!aNULL:!MD5;
if ( $host != 'www.shmaur.com' ) {
rewrite ^(.*)$ https://www.shmaur.com permanent;
}
location =/ {
proxy_pass http://127.0.0.1:端口/share/index.html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header Connection "upgrade";
proxy_redirect off;
}
location / {
proxy_pass http://127.0.0.1:端口/share/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
}