nginx版本 1.14.2
behind.htesemi.com.conf
server {
listen 80;
server_name behind.xxx.com;
rewrite ^(.*)$ https://$host$1;
location / {
index index.php index.html index.htm;
}
}
server {
ssl on;
listen 443 ssl;
server_name behind.xxx.com;
index index.php index.html index.htm;
root /data/www/behind;
ssl_certificate /usr/local/nginx/conf/cert/behind.xxxx.com.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/behind.xxx.com.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;
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;
}
# rewrite rule
include /usr/local/nginx/conf/rewrite/default.conf;
access_log /tmp/log/nginx/access/behind.xxx.com.log;
}
fbgaonline.com.conf
server {
listen 80;
server_name xxx.com;
rewrite ^(.*)$ https://www.xxx.com$1;
location / {
index index.php index.html index.htm;
}
}
server {
ssl on;
listen 443 ssl;
server_name www.xxx.com;
index index.html index.htm index.php;
root /data/www/mmlog;
ssl_certificate /usr/local/nginx/conf/cert/xxx.com.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/xxx.com.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;
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;
}
# rewrite rule
include /usr/local/nginx/conf/rewrite/default.conf;
access_log /tmp/log/nginx/access/xxx.com.log;
}
默认访问IP直接跳转到域名:
server {
listen 80 default;
server_name _;
rewrite ^(.*)$ https://www.fbgaonline.com$1;
}