RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
电话:0833-2438125
服务时间:9:00-21:00
你可能遇到了下面的问题
关闭右侧工具栏
nginx配置443端口
    发布时间:2023-05-20   访问量:13123


server {        listen 80;        server_name abc.com;        return 301 https://$host$request_uri;            #可用301跳转(选其一)        rewrite ^(.*)$  https://abc.com$1 permanent; #也可用地址重写规则(选其一)}

server {    listen 443 ssl;    server_name  abc.com;    ssl_certificate     /etc/nginx/ssl/abc.crt;    ssl_certificate_key /etc/nginx/ssl/abc.key;    ssl_session_timeout 5m;    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;    ssl_ciphers   ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:-LOW:!aNULL:!eNULL;    ssl_prefer_server_ciphers  on;    add_header Access-Control-Allow-Origin *;    add_header Access-Control-Allow-Headers X-Requested-Wit,content-typeh;    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;    location / {    root  /home/abc;    }     access_log  off;}

配置可用于 php 环境,同时实现443端口的跳转

server {        listen 80;        server_name abc.com;        return 301 https://$host$request_uri;            #可用301跳转(选其一)        rewrite ^(.*)$  https://abc.com$1 permanent; #也可用地址重写规则(选其一)}server {    listen 443 ssl;    server_name abc.com;    ssl_certificate     /etc/nginx/ssl/abc.crt;    ssl_certificate_key /etc/nginx/ssl/abc.key;    root /usr/share/nginx/abc.com/;    index index.php  index.html index.htm;location ~ .php($|/) {        fastcgi_pass  127.0.0.1:9000;        fastcgi_read_timeout 300;        fastcgi_index index.php;        fastcgi_split_path_info ^(.+.php)(.*)$;        fastcgi_param  PATH_INFO $fastcgi_path_info;        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;        include         fastcgi_params;        add_header Access-Control-Allow-Origin *;        add_header Access-Control-Allow-Headers X-Requested-Wit,content-typeh;        add_header Access-Control-Allow-Methods GET,POST,OPTIONS;        }        location / {        try_files $uri $uri/ /index.php$is_args$query_string;                if (!-e $request_filename) {                    rewrite ^(.*)$ /index.php?s=$1 last;                    break;                }        }        access_log off;}


上一篇:云服务器安全防护技巧

下一篇:没有了!