#
# HTTPS server configuration 
# 配置文件默认位于 [root@hexingxing conf.d]# pwd
# /etc/nginx/conf.d
#

server {
listen 443;
ssl on;
server_name  yourname.com; #指向服务器的域名
root         /yourdir/httpfile; #网页文件存放在位置
index index.php index.html index.htm;
ssl_certificate   /etc/nginx/sslkey/yourpemcode.pem; #cert.pem 文件,注意文件的位置
ssl_certificate_key  /etc/nginx/sslkey/yourkeycode.key; #cert.key 文件,注意文件的位置
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;
location / {
root /yourdir/httpfile; #网页文件存放在位置
index index.php index.html index.htm;
}



    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        fastcgi_param  SCRIPT_FILENAME  /yourdir/httpfile$fastcgi_script_name; #网页文件存放在位置
        include        fastcgi_params;
    }

}

#
#    error_page 404 /404.html;
#        location = /40x.html {
#    }
#
#    error_page 500 502 503 504 /50x.html;
#        location = /50x.html {
#    }
#}

何星星原创文章仅用于个人学习,当前页面暂不支持复制操作,了解详情或文章转载请 点此 继续!
分类: 系统运维

1 条评论

HTTPS 时代,使用 Certbot (Let’s Encrypt) – 何小湘 · 2017年12月23日 21:47

[…] nginx https 配置 […]

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用*标注