nginx+php 開啟https


nginx 配置如下,配置好重啟nginx,不是nginx -s reload,如果還不能訪問肯定就是防火牆問題,關閉防火牆再試試。

我遇到的問題是:我服務器是ecs,域名解析到阿里雲復雜均衡的,結果怎么調試都不行,后來才知道阿里的負載均衡證書必須要在阿里上購買,其他的證書都不行,我把域名重新解析到ecs地址后就完全正常了。

server {

  listen 80;
  server_name www.xxx.com;
  rewrite ^(.*)$ https://$host$1 permanent;
}
server {
  listen 443 ssl http2;
  server_name www.xxx.com;
  access_log /var/log/nginx/fir-https_access.log main;
  error_log /var/log/nginx/fir-https_error.log error;
  ssl_certificate /data1/www/key/fir.pem;
  ssl_certificate_key /data1/www/key/fir.key;
  ssl_session_timeout 5m;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_session_cache shared:SSL:1m;
  ssl_ciphers HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers on;
  fastcgi_param HTTPS on;
  fastcgi_param HTTP_SCHEME https;
  root /data1/www/fir;
    location / {
      index index.html index.php;
      #root /data1/www/fir;
      autoindex off;
      }
    location ~ \.php(.*)$ {
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
      include fastcgi_params;
}
}

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM