https和http共存的nginx配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了https和http共存的nginx配置相关的知识,希望对你有一定的参考价值。
server {
listen 80;
listen 443 ssl;
server_name test.xx.com;
index index.html index.htm index.php;
root /usr/local/default;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
#expires 30d;
}
location ~ .*\.(js|css)?$
{
#expires 1h;
}
access_log logs/test.access.log;
ssl_certificate /x.com_bundle.crt;
ssl_certificate_key /x.com.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;
}
以上是关于https和http共存的nginx配置的主要内容,如果未能解决你的问题,请参考以下文章
2.10Nginx环境下http和https(ssl)共存的方法
Nginx一个server主机上80433httphttps共存