Nginx, HTTPS的配置

Posted 点墨小僧

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Nginx, HTTPS的配置相关的知识,希望对你有一定的参考价值。

server {
listen 443;      ####HTTPS指定端口
server_name www.web.com;      #####域名或者IP

root /data/wwwroot/laravel/public;           #####项目所在绝对路径,项目入口
index index.php index.html index.htm ;

########################################################
## HTTPS ##
ssl on;

ssl_certificate /usr/local/nginx/cert/214235201250226.pem;
ssl_certificate_key /usr/local/nginx/cert/214235201250226.key;
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;
#########################################################

try_files $uri $uri/ @rewrite;

location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}

location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}

location ~ [^/]\.php(/|$) {
# fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;

####################################################
## HTTPS ##
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
####################################################

include fastcgi.conf;
}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
# access_log off;
}

location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}

}












































以上是关于Nginx, HTTPS的配置的主要内容,如果未能解决你的问题,请参考以下文章

nginx配置https

nginx 配置https

nginx配置https

配置nginx支持https

nginx基本用法和HTTPS配置

Nginx 配置HTTPS 与Node.js 配置HTTPS方法