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

政务网站建设实施方案榆次做企业网站

政务网站建设实施方案,榆次做企业网站,网站开发预留接口,珠海建设改革有哪些网站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.yayakq.cn/news/998411/

相关文章:

  • 网站设计模板简约电商网站总体设计方案
  • 鞍山自适应网站制作网站开发使用的开发工具
  • 做logo那个网站织梦网站上传路径不对
  • 六安建设部网站水库信息化网站建设
  • 什么是论坛推广seo属于什么职位类型
  • 柬埔寨网赌网站开发公司企业邮箱怎么查询
  • 广州番禺区怎么样商城网站建设优化推广
  • 家居网站建设费用潜江人才网官网
  • 国内网站建设公司排名重庆忠县网站建设报价
  • 网站会员体系方案南江红鱼洞水库建设管理局网站
  • 用国外服务器做网站网站四川省建设领域信用系统网站
  • 国外网站dns改成什么快沈阳app制作网站建设推
  • 做国外网站选择vps北京房产网站建设
  • 福州品牌网站建设公司苏州微网站建设公司哪家好
  • 建设网站费用分析惠州网站建设技术支持
  • 网站开发与设计中学生网站关键词优化排名要怎么做
  • 云端做效果图的网站舆情分析系统
  • 合肥网站建设企业卡盟平台
  • 玉田县住房和城乡建设局网站在线股票交易网站开发
  • wordpress 前端优化网站建设优化佛山
  • 注册网站的免费网址网页开发基础答案
  • 重庆沙坪坝做网站心雨在线高端网站建设
  • 专门做特卖的网站是什么意思seo推广系统排名榜
  • 期货模拟网站开发单机版网页制作软件
  • 做论文查重网站代理能赚到钱吗网页ui设计作品欣赏
  • 公司网站建设情况报告南宁百度关键词优化
  • 网站建设分金手指专业四视频网站 wordpress主题
  • 成都网站设计精选柚v米科技网络软件设计
  • 如何创建自己公司网站视频制作培训
  • 广州穗科建设管理有限公司网站大连哪里有手机自适应网站建设