当前位置: 首页 > news >正文

顶棒 技术支持 东莞网站建设做h网站怎么才能安全

顶棒 技术支持 东莞网站建设,做h网站怎么才能安全,外贸网站中的搜索产品功能如何实现,文化传媒网站封面https 访问我们的测试域名 https://www.xxx.com 站点,但是当我们直接在浏览器地址栏中直接输入 www.xxx.com 的时候却发现进入的是 http 协议的网站,这与我们的初衷不一致。由于浏览器默认访问域名使用的是80端口,而当我们使用SSL证书后&…

https 访问我们的测试域名 https://www.xxx.com 站点,但是当我们直接在浏览器地址栏中直接输入 www.xxx.com 的时候却发现进入的是 http 协议的网站,这与我们的初衷不一致。

由于浏览器默认访问域名使用的是80端口,而当我们使用SSL证书后,网站的端口就变成了443,所以当我们直接在浏览器中输入网址 www.xxx.com 的时候进入的是 80 端口的 HTTP 站点而不是 443 端口的 HTTPS 站点。

解决方法

这里提供两种 http 跳转到 https 的方法:

1. 使用nginx的 rewrite 将请求过来的 http URL直接重写成 https

server {

listen 80;

#填写绑定证书的域名

server_name www.xxx.com;

#强制将http的URL重写成https

rewrite ^(.*) https://$server_name$1 permanent;

}

2. 使用301重定向的方式将 http 的请求重定向到 https 上

server {

listen 80;

#填写绑定证书的域名

server_name www.xxx.com;

#把http的域名请求转成https

return 301 https://$host$request_uri;

}

3.完整的代码

# https配置

server {

listen 443 ssl;

server_name www.xxx.com xxx.com;

#ssl on; #开启ssl支持

ssl_certificate /data/ssl/www.xxx.com.pem; #指定服务器证书路径

ssl_certificate_key /data/ssl/www.xingguangshe.com.key; #指定私钥证书路径

ssl_session_timeout 5m;

#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

#ssl_prefer_server_ciphers on;

root /myweb/new/xxx.com;

location / {

index index.php index.html index.htm;

if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php/$1 last;

break;

}

}

location ~ \.php/?.*$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;

fastcgi_intercept_errors on;

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;

#fastcgi_pass php-fpm; #uquq use this

}

location ~ /\.ht {

deny all;

}

}

#http配置

server {

listen 80;

#listen somename:8080;

server_name www.xxx.com xxx.com;

client_max_body_size 80m;

#error_page 404 /data/ymg280/404.html;

#error_page 500 502 503 504 /errors/default/50x.html;

rewrite ^(.*) https://$server_name$1 permanent;

if ($host != 'ww.xxx.com'){

#rewrite ^/(.*)$ http://www.xxx.com/$1 permanent;

}

root /myweb/new/xxx.com;

location / {

index index.php index.html index.htm;

if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php/$1 last;

break;

}

}

#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php/?.*$ {

fastcgi_pass 127.0.0.1:9000;

fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;

fastcgi_intercept_errors on;

fastcgi_index index.php;

include fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;

#fastcgi_pass php-fpm;

}

#deny access to .htaccess files, if Apache's document root

location ~ /\.ht {

deny all;

}

}

http://www.15wanjia.com/news/191032.html

相关文章:

  • 有个网站专做品牌 而且价格便宜合肥建站公司有哪家招聘的
  • 通州网站网站建设天津企商网站建设公司
  • 手机支付网站开发跨境电商最火的产品
  • 商城网站源码打开百度网页
  • 一站式网站开发服务平台经典手机网站
  • 网站源码怎么做app设计思路怎么写
  • 东莞网站推广排名邢台市住建局
  • 怎么免费申请网站域名域名注册完成后怎么做网站
  • jquery 购物网站刚刚地震最新消息今天2022
  • 怎么用织梦修改建设一个新的网站电子书网站模板
  • 网站建设方案策划书网站营销站点有你想
  • 网站制作导航超链接怎么做怎么上wordpress
  • 免费空间做网站建设部网站危房鉴定标准规定
  • 江门网站优化公司如何用手机做音乐网站
  • 为什么做网站还要续费网站开发和竞价
  • 做dnf辅助官方网站wordpress实战memcahce
  • 红酒手机网站建设商家免费入驻平台
  • 有没有做游戏评测的网站亳州做企业网站
  • 四川企业网站建设互联网公司排名2024
  • 视频网站开发的难点怎样写营销策划方案
  • 传奇页游排行榜湖南关键词优化排名推广
  • 建立自己的网站可以采用的方式有网站移动转换
  • jeecms 怎么建设网站专门做t恤的网站
  • 福建城乡建设网站莱芜金点子今天最新招聘电子版
  • 单页面企业网站莱芜可信赖的网络推广公司
  • 旅游网站设计方案怎么做科技公司官网设计
  • 在小说网站做编辑怎么找门户网站 流量
  • 公司网站怎么备案北京小程序网站制作
  • 扬州推广公司上海最大的seo公司
  • 天门市网站建设直播间网站开发制作