重定向
server {
listen 80;
server_name xx.com;
rewrite ^/(.*)$ http://www.xx.com/$1 redirect;
}
转发配置
server {
listen 80;
server_name xx.com;
server_name www.xx.com;
location / {
proxy_pass http://0.0.0.0:80;
proxy_set_header Host $proxy_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
重定向移动端
if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) {
rewrite ^/(.*)$ https://m.smartup.global/$1 redirect;
}
https配置
server{
listen 443;
server_name fantazzzz.com;
location / {
root /root/blog/fantazz.github.io;
}
ssl on;
ssl_certificate /etc/nginx/certificate/3272485_fantazzzz.com.pem;
ssl_certificate_key /etc/nginx/certificate/3272485_fantazzzz.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
}