# 以下属性中以ssl开头的属性代表与证书配置有关,其他属性请根据自己的需要进行配置。
server {
listen 443 ssl; #SSL协议访问端口号为443。此处如未添加ssl,可能会造成Nginx无法启动。
server_name world.qiangshangkeji.com; #将localhost修改为您证书绑定的域名,例如:www.example.com。
root /var/www/web/centos7/world.qiangshangkeji.com;
index index.html index.htm;
ssl_certificate conf.d/cert/4324189_world.qiangshangkeji.com.pem; #将domain name.pem替换成您证书的文件名 这里的目录要从nginx.conf所在目录 /etc/nginx为根目录开始写相对路径。
ssl_certificate_key conf.d/cert/4324189_world.qiangshangkeji.com.key; #将domain name.key替换成您证书的密钥文件名 这里的目录要从nginx.conf所在目录 要从/etc/nginx为根目录开始写相对路径。
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #使用此加密套件。
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #使用该协议进行配置。
ssl_prefer_server_ciphers on;
location / {
root /var/www/web/centos7/world.qiangshangkeji.com; #站点目录。
index index.html index.htm index.php;
}
access_log /var/log/nginx/world.qiangshengkeji.com.access.log main;
error_log /var/log/nginx/world.qiangshengkeji.com.error.log;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ .php$ {
# proxy_pass http://127.0.0.1;
#}
# 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;
# include fastcgi_params;
#}
#
location ~ .php$ {
#root /var/www/web/world.qiangshangkeji.com;
root /var/www/web/centos7/world.qiangshangkeji.com;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/run/php-fpm/www.sock #CentOS/RHEL/Fedora
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /.ht {
# deny all;
#}
}