我想对端口 80 执行 301 重定向到 https 443
当前配置如下:
server {
listen 78.34.163.12:80;
server_name example.com *.example.com;
return 301 https://$host$request_uri;
location / {
proxy_pass http://78.34.163.12:8085;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|html|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|pdf|psd|ai|eot|eps|ps|zip|tar|tgz|gz|rar|bz2|7z|aac|m4a|mp3|mp4|ogg|wav|wma|3gp|avi|flv|m4v|mkv|mov|mpeg|mpg|wmv|exe|iso|dmg|swf)$ {
root /home/dave/web/gldn.page/public_html;
access_log /var/log/apache2/domains/example.com.log combined;
access_log /var/log/apache2/domains/example.com.bytes bytes;
expires max;
try_files $uri @fallback;
}
}
location /error/ {
alias /home/dave/web/example.com/document_errors/;
}
location @fallback {
proxy_pass http://78.34.163.12:8085;
}
location ~ /\.(?!well-known\/|file) {
deny all;
return 404;
}
include /home/dave/conf/web/example.com/nginx.conf_*;
}
所以,我的问题是:
在该行之后 返回 301 https://$host$request_uri;
还有什么需要处理吗?
例如:
缓存中是否存储了任何文件?
是否会记录任何错误?
如果没有的话,是不是更好的办法是:
server {
listen 78.34.163.12:80;
server_name example.com *.example.com;
return 301 https://$host$request_uri;
}
希望你能帮助我理解这一点:)
谢谢